;; ;;=====================================================================================----- ;; ;;FUNCTION ArrayAdd() ;; ;;ACTION Combines 2 arrays into one ;; ;;AUTHOR Allen Powell ;; Adapted, formatted, & Documented by Glenn Barnas ;; ;;VERSION 1.0 - 2014/01/11 ;; ;;HISTORY 1.0 - 2014/01/11 - Initial Release ;; ;;SYNTAX ArrayAdd(Array1, Array2) ;; ;;PARAMETERS Array1 - Required - First Array ;; ;; Array2 - Required - Second Array ;; ;;REMARKS Extends Array1 with the values in Array2. Arrays must be ;; single dimensioned. ;; ;;RETURNS Array - contents of Array1 with contents of Array2 appended ;; ;;DEPENDENCIES none ;; ;;TESTED WITH WXP, W2K3, W2K8, W2K12, Win7, Win8 ;; ;;EXAMPLES $Array1 = ArrayAdd($Array1, $Array2) ; ; Function ArrayAdd($_Array1, $_Array2) Dim $_N, $_I ; Get size of original array + 1 $_N = UBound($_Array1) + 1 ; Extend the first array by the size of the second array, preserving contents ReDim Preserve $_Array1[$_N + UBound($_Array2)] ; Enumerate the second array and add the values to the first array For $_I = 0 to UBound($_Array2) $_Array1[$_N + $_I] = $_Array2[$_I] Next ; Return the modified first array and exit with Success $ArrayAdd = $_Array1 Exit 0 EndFunction