Jump to content

Recommended Posts

Posted (edited)

Here are two samples for launching and keeping an eye on other applications.

It is handy when it comes to dealing with webservers: we can keep the little AutoIT icon in the taskbar and terminate the webserver when needed.

The important bit is:

Global $SUPERVISED_PID___GLOBAL = 0
OnAutoItExitRegister("OnAutoItExitV01")

And the function:

Func OnAutoItExitV01()
    ; was there an error?
    If @exitCode Then Return
    ; close by clicking on exit of the systray?
    If @exitMethod = 2 Then
        ; close the grand-children as well
        $list = _ProcessGetChildren($SUPERVISED_PID___GLOBAL)
        If IsArray($list) Then
            For $i = 1 To $list[0][0]
                If ProcessExists($list[$i][0]) Then
                    ProcessClose($list[$i][0])
                    ProcessWaitClose($list[$i][0])
                EndIf
            Next
        EndIf
        ; close the main process
        If ProcessExists($SUPERVISED_PID___GLOBAL) Then ProcessClose($SUPERVISED_PID___GLOBAL)
    EndIf
EndFunc   ;==>OnAutoItExitV01

Credits: SmOke_N for the _ProcessGetChildren function

( http://www.autoitscript.com/forum/index.php?showtopic=78445 )

LaunchTrac.au3

LaunchApacheOnly.au3

_ProcessGetChildren.au3

LaunchZendApacheOnly.au3

Edited by Chess

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...