narciso Posted May 7, 2007 Posted May 7, 2007 Hello, I have a AutoIt3 script that launches a third party application and automates some operations on it mainly by sending keys. I would like the script to exit when the user has closed up the controlled application. Now it remains paused on the tray which is not what I want. Thanks in advance for your help. Warmly,Narciso
Xenobiologist Posted May 7, 2007 Posted May 7, 2007 Hi, if Not ProcessExists() Then Exit So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
ChrisL Posted May 7, 2007 Posted May 7, 2007 or $proc = Run("C:\MyApplication.exe","C:\") ;you can do other stuff here While ProcessExists($Proc);wait for the program to close Sleep(1000) WEnd Exit [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
The Kandie Man Posted May 7, 2007 Posted May 7, 2007 Or you could do this: AdlibEnable("CheckIfStillExists",100);check every 100ms to see if the window or process has closed ;Your main script goes here Func CheckIfStillExists() If Not ProcessExists("Process.exe") Then Terminate() ;~ If Not WinExists("Application Window") Then Terminate();You could also do this if it is a window that is being closed EndFunc Func Terminate() ;Stop doing whatever it is that you are doing. Maybe give an error message, close open file handles, whatever Exit;Now exit the script EndFunc - The Kandie Man ;-) "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
narciso Posted May 8, 2007 Author Posted May 8, 2007 Or you could do this: AdlibEnable("CheckIfStillExists",100);check every 100ms to see if the window or process has closed ;Your main script goes here Func CheckIfStillExists() If Not ProcessExists("Process.exe") Then Terminate() ;~ If Not WinExists("Application Window") Then Terminate();You could also do this if it is a window that is being closed EndFunc Func Terminate() ;Stop doing whatever it is that you are doing. Maybe give an error message, close open file handles, whatever Exit;Now exit the script EndFunc - The Kandie Man ;-)Thank you all and especially Kandie Man. That's exactly what I needed!!! Warmly,Narciso
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