Deon Posted February 12, 2016 Share Posted February 12, 2016 I have an array that looks like: ______________________ |123456|ABCDEF|999999| ______________________ And I want to have Autoit create a new column at the start and grab the first 3 characters of the next column, so the array would now look like this: __________________________ 123|123456|ABCDEF|999999| __________________________ I've had a bit of a play with some of the _Array functions but can't really find anything to duplicate the column, so I'm not sure where to start. Any help appreciated! Link to comment Share on other sites More sharing options...
JohnOne Posted February 12, 2016 Share Posted February 12, 2016 #include <Array.au3> Local $array1[1][3] = [[123456,"ABCDEF",999999]] Local $array2[UBound($array1)][UBound($array1, 2) + 1] For $i = 0 To UBound($array1) -1 $array2[$i][0] = StringLeft($array1[$i][0], 3) $array2[$i][1] = $array1[$i][0] $array2[$i][2] = $array1[$i][1] $array2[$i][3] = $array1[$i][2] Next _ArrayDisplay($array2) Deon 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jdelaney Posted February 12, 2016 Share Posted February 12, 2016 (edited) #include <Array.au3> Local $a[2][3] = [[123456,"ABCDEF",999999],["blah","ablah","bblah"]] ReDim $a[UBound($a)][4] For $i = 0 To UBound($a)-1 $a[$i][3] = $a[$i][2] $a[$i][2] = $a[$i][1] $a[$i][1] = $a[$i][0] $a[$i][0] = StringLeft($a[$i][0],3) Next _ArrayDisplay($a) edit: beat me by this much *fingers very close together* Edited February 12, 2016 by jdelaney Deon 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Deon Posted February 12, 2016 Author Share Posted February 12, 2016 Thanks gents, works perfectly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now