celestialspring Posted August 21, 2010 Share Posted August 21, 2010 Hi Guys, The script I am trying to write it simple: Read a CSV file, say Test.CSV Split it per line then save each line to a file by the name of Test1.csv, Test2.csv and so on... I have been able to write only until this point (see below) any ideas what I should be doing next? =======BEGIN============ #Include <file.au3> $fileorg = "c:\test.csv" FileOpen($fileorg) Dim $aRecords $linenumbercount = _FileCountLines($fileorg) $fileread = _FileReadToArray($fileorg,$aRecords) For $x = 1 to $aRecords _FileWriteFromArray(????) ============END==================== Thanks. CS Link to comment Share on other sites More sharing options...
JackDinn Posted August 21, 2010 Share Posted August 21, 2010 (edited) Morning #include <file.au3> $fileorg = "test.csv" FileOpen($fileorg, 0) Dim $aRecords[100] $fileread = _FileReadToArray($fileorg, $aRecords) FileClose($fileorg) For $x = 1 To $aRecords[0] FileWrite("test" & $x & ".csv", $aRecords[$x]) Next Edited August 21, 2010 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
JackDinn Posted August 21, 2010 Share Posted August 21, 2010 hmm, just thought there is a shorter way but its too early in the morning for me :-/ Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
celestialspring Posted August 21, 2010 Author Share Posted August 21, 2010 A very good morning to you too sir. Thank you very much. The script works perfectly Link to comment Share on other sites More sharing options...
Tvern Posted August 21, 2010 Share Posted August 21, 2010 (edited) It works, but there are still a few unneeded elements in it. This should be an improvement: edit:The script in the next post is even better. Mine actually had a pretty stupid mistake in it. Edited August 21, 2010 by Tvern Link to comment Share on other sites More sharing options...
JackDinn Posted August 21, 2010 Share Posted August 21, 2010 ahh, i was sure there was a shorter way to do this (as i said, it was far to early for me) #include <file.au3> $fileorg = "test.csv" $file = FileOpen($fileorg, 0) For $x = 1 To _FileCountLines($fileorg) FileWrite("test" & $x & ".csv", FileReadLine($file)) Next FileClose($fileorg) thats the shortest i can get it without getting silly (which this is really ) Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D 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