Snarg Posted April 27, 2004 Posted April 27, 2004 I understand the topic is poorly phrased, but I can not think of a better way to phrase it. I would like my script to start a program. The script is going to check and see if the program started. If it did not start, I would like to to go back to the begining and try again. Since we no longer have GoTo (Yeah, I used it a lot), I would like to know of another way to do this. Here is what I have: ReadInfo () StartProgram () $CheckWindow = WinExists ( 'Program' ) If $CheckWindow = 0 Then Run ( 'another_program.exe' & ' ' & $Paramaters, @SCRIPTDIR ) Sleep ( 5000 ) EndIf NextFunction () If the window does not exist, I would like the script to return back to ReadInfo () and start over from the begining.. Any help is greatly appreciated, thank you. A little reading goes a long way. Post count means nothing.
Developers Jos Posted April 27, 2004 Developers Posted April 27, 2004 (edited) somthing like : do ReadInfo () StartProgram () sleep(2000) untill WinExists ( 'Program' ) Edited April 27, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Snarg Posted April 27, 2004 Author Posted April 27, 2004 (edited) Thank you for the help. I put it all into the 'StartProgram' function. This is what I came up with: Func StartProgram () Do $Switches = IniRead ( $SettingsFile, $Variable, 'Paramater', "ERROR" ) Run ( $ProgramPath & '\' & $ProgramExecutable & ' ' & $Switches, $ProgramPath ) Sleep ( $LoadDelay ) $CheckWindow = WinExists ( 'Program' ) If $CheckWindow = 0 Then Run ( 'another_program' & ' ' & $Variables, @SCRIPTDIR ) Sleep ( 5000 ) EndIf Until WinExists ( 'Program' ) Return EndFunc Once again, thank you. Edited April 27, 2004 by Snarg A little reading goes a long way. Post count means nothing.
scriptkitty Posted April 27, 2004 Posted April 27, 2004 one other thought while 1 run("notepad.exe") sleep(1000) ; do something if NOT winexists("Untitled") then continueloop; this would restart at while 1 ; do more stuff exitloop Wend MsgBox(1,"hi","there") So many ways.... AutoIt3, the MACGYVER Pocket Knife for computers.
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