TuMiM Posted January 20, 2006 Posted January 20, 2006 (edited) I have a script that uses the send command to send a bunch of text to a program. The text has about 5000 entries every time with one entry on each line. Currently, i have to do some find and replace in order to get the send command before and after each entry on the line to make a script out of it. Is there a way to have a script read each line in a text file and send each line with a TAB after each line? I hope that makes sense. Here is what my script looks like now WinWaitActive("System 08.12", "Build Scan List") Send("3003759{TAB}") Send("00000120156{TAB}") Send("00000123909{TAB}") Send("00000105653{TAB}") Send("4002860{TAB}") Send("4002872{TAB}") Edited January 20, 2006 by TuMiM
seandisanti Posted January 20, 2006 Posted January 20, 2006 I have a script that uses the send command to send a bunch of text to a program. The text has about 5000 entries every time with one entry on each line. Currently, i have to do some find and replace in order to get the send command before and after each entry on the line to make a script out of it. Is there a way to have a script read each line in a text file and send each line with a TAB after each line? I hope that makes sense. Here is what my script looks like now WinWaitActive("System 08.12", "Build Scan List") Send("3003759{TAB}") Send("00000120156{TAB}") Send("00000123909{TAB}") Send("00000105653{TAB}") Send("4002860{TAB}") Send("4002872{TAB}")untested, but try this... in the end, $tmp will contain a large string with tabs after each line... Dim $blah, $tmp = "" _FileReadToArray("c:\test.txt",$blah) $x = 1 While $x < $blah[0] $tmp = $tmp & $blah[$x] & Chr(9) $x = $x + 1 WEnd $tmp = $tmp & $blah[$x+1]
TuMiM Posted January 20, 2006 Author Posted January 20, 2006 That gives me an error and I am not sure why. I have attached the error
seandisanti Posted January 20, 2006 Posted January 20, 2006 That gives me an error and I am not sure why. I have attached the errorhaha, laughing at myself sorry, did things the hard way... try this one.. #include<file.au3> #include<array.au3> Dim $filearray,$filestring _FileReadToArray("c:\test.txt",$filearray) $filestring = _ArrayToString($filearray,Chr(9))
TuMiM Posted January 20, 2006 Author Posted January 20, 2006 That works great! Thanks. The only thing is that the first entry it makes is a number of how many entries there are. So for example 3 entries outputs 3 12345 54321 65432 Is there any way to get rid of the 3?
seandisanti Posted January 20, 2006 Posted January 20, 2006 That works great! Thanks. The only thing is that the first entry it makes is a number of how many entries there are. So for example 3 entries outputs 3 12345 54321 65432 Is there any way to get rid of the 3?my bad, i forgot to include the optional base parameter on the _ArrayToString, that line should actually read: $filestring = _ArrayToString($filearray,Chr(9),1,$filearray[0])
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