Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...