treefingers Posted June 16, 2007 Share Posted June 16, 2007 Hello Autoit community! I am, well, not a programmer. I need your help! Some background information: I'm trying to write a script that automates taking invoice numbers from a text file, and inputs every 50 lines of them in our point of sale software, pausing to print every 50 lines. So, basically I need to have a Send("!r") after 50 lines of reading text from a text file. How do I do that? This is the code I have so far (which the majority of came from www.rick-davis.com), and it does exactly what I need it to do, except it reads and enters all 600+ lines. I just need it to "run" every 50.. CODE$fileVariableName = FileOpen("invoices.txt", 0) If $fileVariableName = -1 Then MsgBox(0,"Failure","Failed to open file") Exit EndIf While 1 $lineVariableName = FileReadLine($fileVariableName) If @error = -1 Then ExitLoop WinActivate("Completed Order Re-Print") Send($lineVariableName) Sleep(500) Send("{ENTER}") Sleep(500) Send("!a") Sleep(1000) WEnd FileClose($fileVariableName) Don't mind all the sleeps, our point of sale software is very slow! That is the main reason I can only print 50 orders at a time as well.. Thanks for your help! Link to comment Share on other sites More sharing options...
TomZ Posted June 16, 2007 Share Posted June 16, 2007 (edited) Something like this maybe? $fileVariableName = FileOpen("invoices.txt", 0) If $fileVariableName = -1 Then MsgBox(0,"Failure","Failed to open file") Exit EndIf While 1 For $x = 1 to 50 $lineVariableName = FileReadLine($fileVariableName) If @error = -1 Then ExitLoop 2 WinActivate("Completed Order Re-Print") Send($lineVariableName) Sleep(500) Send("{ENTER}") Sleep(500) Send("!a") Sleep(1000) Next Send("!r") WEnd FileClose($fileVariableName) Edited June 16, 2007 by TomZ Link to comment Share on other sites More sharing options...
treefingers Posted June 16, 2007 Author Share Posted June 16, 2007 Thanks! That was fast! 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