celestialspring 1 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 Share this post Link to post Share on other sites
JackDinn 1 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 TesterJD's Clip Catch (With Screen Shot Helper)Projects :- AutoIt - My projectsMy software never has bugs. It just develops random features. :-D Share this post Link to post Share on other sites
JackDinn 1 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 TesterJD's Clip Catch (With Screen Shot Helper)Projects :- AutoIt - My projectsMy software never has bugs. It just develops random features. :-D Share this post Link to post Share on other sites
celestialspring 1 Posted August 21, 2010 A very good morning to you too sir. Thank you very much. The script works perfectly Share this post Link to post Share on other sites
Tvern 11 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 Share this post Link to post Share on other sites
JackDinn 1 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 TesterJD's Clip Catch (With Screen Shot Helper)Projects :- AutoIt - My projectsMy software never has bugs. It just develops random features. :-D Share this post Link to post Share on other sites