ProductOfMomAndDad Posted February 26, 2006 Posted February 26, 2006 Hi real programmers! Behold a text file: 123,654,789,098 453,765,982,180 765,432,987,222 I started with FileReadLine to $tempString After that i used StringSplit and i populated $tempArray like this: $tempArray[0]=4 $tempArray[1]=123 $tempArray[2]=654 $tempArray[3]=789 $tempArray[4]=098 Now i want to populate $finalArray, which is TWO-dimensional as follows: $finalArray[$ruleNumber][1] = $tempArray[1] $finalArray[$ruleNumber][2] = $tempArray[2] $finalArray[$ruleNumber][3] = $tempArray[3] $finalArray[$ruleNumber][4] = $tempArray[4] But that doesn't work of course. How can i do that? Bye, bye! Find the job of your life and you will never have to work again!
Moderators SmOke_N Posted February 26, 2006 Moderators Posted February 26, 2006 Hi real programmers! Behold a text file: 123,654,789,098 453,765,982,180 765,432,987,222 I started with FileReadLine to $tempString After that i used StringSplit and i populated $tempArray like this: $tempArray[0]=4 $tempArray[1]=123 $tempArray[2]=654 $tempArray[3]=789 $tempArray[4]=098 Now i want to populate $finalArray, which is TWO-dimensional as follows: $finalArray[$ruleNumber][1] = $tempArray[1] $finalArray[$ruleNumber][2] = $tempArray[2] $finalArray[$ruleNumber][3] = $tempArray[3] $finalArray[$ruleNumber][4] = $tempArray[4] But that doesn't work of course. How can i do that? Bye, bye! Find the job of your life and you will never have to work again!Have an actual script to go off of so we aren't guessing what $ruleNumber is? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
ProductOfMomAndDad Posted February 26, 2006 Author Posted February 26, 2006 Have an actual script to go off of so we aren't guessing what $ruleNumber is?Sorry, SmOke_N, $rulenumber is just the linenumber of the textfile.In the textfile above _FileCountLines gives 3.I am using each line in the textfile as a record. The four numbers belong to each other.
Moderators SmOke_N Posted February 26, 2006 Moderators Posted February 26, 2006 Again, without your script, I have no idea what your really trying to accomplish... I guess I'll chase the tail one time:Local $aArray = StringSplit('123,654,789,098', ',') Local $tArray[5][5] For $i = 1 To UBound($aArray) - 1 $tArray[$i][1] = $aArray[$i] $tArray[$i][2] = $aArray[$i] $tArray[$i][3] = $aArray[$i] $tArray[$i][4] = $aArray[$i] Next For $x = 1 To UBound($tArray) - 1 MsgBox(0, 'Example', $tArray[$x][$x]) Next Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Moderators SmOke_N Posted February 26, 2006 Moderators Posted February 26, 2006 This made more sense:#include <file.au3> Local $FilePath = @DesktopDir & '\2Darray.txt' Local $nArray = '' _FileReadToArray($FilePath, $nArray) Local $tArray[UBound($nArray)][5] For $i = 1 To UBound($nArray) - 1 Local $aArray = StringSplit($nArray[$i], ',') For $x = 1 To UBound($aArray) - 1 $tArray[$i][$x] = $aArray[$x] Next Next For $x = 1 To UBound($tArray) - 1 For $i = 1 To 4 MsgBox(0, 'Test', $tArray[$x][$i]) Next Next Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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