Zuldan Posted November 25, 2009 Posted November 25, 2009 Ok I got a tricky problem. I have the following code....------------------------------Run("myfile.exe")while 1 WinWaitActive("Sever") Send("{ENTER}")wend------------------------------I only want the while loop to run while myfile.exe is running. Once myfile.exe has finished executing I want to exit out of the while loop.Does anyone have any ideas on how I could do this? Maybe I'm approaching it the wrong way.
99ojo Posted November 25, 2009 Posted November 25, 2009 (edited) Ok I got a tricky problem. I have the following code.... ------------------------------ Run("myfile.exe") while 1 WinWaitActive("Sever") Send("{ENTER}") wend ------------------------------ I only want the while loop to run while myfile.exe is running. Once myfile.exe has finished executing I want to exit out of the while loop. Does anyone have any ideas on how I could do this? Maybe I'm approaching it the wrong way. Hi, $pid = Run("myfile.exe") While ProcessExists ($pid) WinWaitActive("Sever") Send("{ENTER}") Sleep (20) WEnd But it doesn't seem to make sense, because it is not clear what happen after the Send command. -> If the exe still runs, then the loop will run and if the window Sever still exists, the Send is still executing. Suggestion: $pid = Run("myfile.exe") $benter = True While ProcessExists ($pid) If $benter Then WinWaitActive("Sever") Send("{ENTER}") $benter = False EndIf Sleep (20) WEnd ;-)) Stefan Edited November 25, 2009 by 99ojo
Zuldan Posted November 25, 2009 Author Posted November 25, 2009 Thank you Stefan! You solved my problem and many other problems I was having with other scripts.
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