JohnCleese Posted July 30, 2009 Share Posted July 30, 2009 Hello, I'm fairly new to autoit. I'm working on a script to launch an app under special conditions through a launcher. But, I'm trying to make it so if I close the launcher without launching the app the script will end. So far I have, Run($launcher, $launcherdirectory) If ProcessExists($launcherexe) =False And ProcessExists($AppExe) =False Then Exit ElseIf ProcessExists($launcherexe) And ProcessExists($AppExe) =False Then ProcessWait($AppExe) EndIF It works, but when it pauses even if I close the launcher the script doesn't end because it's stalled at ProcessWait. Any help would be much appreciated. "I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me." Link to comment Share on other sites More sharing options...
Rarst Posted July 30, 2009 Share Posted July 30, 2009 Ok, if I understand right you have AutoIt script that launches non-AutoIt launcher, that optionally launches program. And you want script to wait until either app starts or launcher closes. If I got logic right this would be like: Run($launcher, $launcherdirectory) If Not ProcessExists($launcherexe) And Not ProcessExists($AppExe) Then Exit ElseIf ProcessExists($launcherexe) And Not ProcessExists($AppExe) Then Do Sleep(100) Until ProcessExists($AppExe) Or Not ProcessExists($launcherexe) EndIf AutoIt tag at Rarst.net Link to comment Share on other sites More sharing options...
JohnCleese Posted July 30, 2009 Author Share Posted July 30, 2009 Thanks for the attempt but that has the same effect as what I have already. It still hangs at the end when Launcher is closed and App wasn't started. "I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me." Link to comment Share on other sites More sharing options...
FireFox Posted July 30, 2009 Share Posted July 30, 2009 Thanks for the attempt but that has the same effect as what I have already. It still hangs at the end when Launcher is closed and App wasn't started. Maybe... RunWait($launcher) If Not ProcessExists($appExe) Then Exit Cheers, FireFox. Link to comment Share on other sites More sharing options...
JohnCleese Posted July 31, 2009 Author Share Posted July 31, 2009 That's not what I need, the process of my script should go like thisRun LauncherWait for App to startIf App doesn't start, and Launcher=closed Then Exit ScriptIf App does start, Then continue with rest of script.But thanks. "I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me." Link to comment Share on other sites More sharing options...
Rarst Posted July 31, 2009 Share Posted July 31, 2009 That's not what I need, the process of my script should go like this Run Launcher Wait for App to start If App doesn't start, and Launcher=closed Then Exit Script If App does start, Then continue with rest of script. But thanks. Hm, first attempt should've roughly worked. Anyway take number two: If Not Run($launcher, $launcherdirectory) Then Exit ;maybe ProcessWait($launcher) here if too fast Do Sleep(250) Until ProcessExists($AppExe) Or Not ProcessExists($launcherexe) If Not ProcessExists ($launcherexe) Then Exit ;else script continues here If this fails as well I'll have to make dummy launcher executable and test with it. >_< Waiting for feedback. AutoIt tag at Rarst.net Link to comment Share on other sites More sharing options...
JohnCleese Posted July 31, 2009 Author Share Posted July 31, 2009 Hm, first attempt should've roughly worked. Anyway take number two: If Not Run($launcher, $launcherdirectory) Then Exit ;maybe ProcessWait($launcher) here if too fast Do Sleep(250) Until ProcessExists($AppExe) Or Not ProcessExists($launcherexe) If Not ProcessExists ($launcherexe) Then Exit ;else script continues here If this fails as well I'll have to make dummy launcher executable and test with it. Waiting for feedback. Awesome! That works just as intended. Thank you very much to the both of you, this has been a great learning experience. >_< "I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me." 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