KillAppChildren
System function.
The KillAppChildren function kills the specified application and its associated children. Not available in WinTask Lite.
Usage
Used to force an application (a program file or EXE) to close; it closes too the children processes started by the parent application.
Syntax
KillAppChildren(<exe_name>,0|1 [,<user_name>])
or
ret=KillAppChildren(<exe_name>,0|1 [,<user_name>])Parameters
<exe_name>, string, name of the application to kill with its associated children. The name of the application is not case sensitive and the extension is not compulsory (for instance, Notepad.exe or Notepad or NOTEPAD are valid <exe_name>). All the instances of the application and its associated children are killed. Note that if the application A calls B, which calls C, if for any reason, B is killed, a KillAppChildren of A won't be able to kill the child C.
If the second parameter is 1, the application is killed immediately. If the second parameter is 0 and if the application cannot be killed after 60 secs, a confirmation dialog box is displayed. If the user does not click OK within 60 secs, the application is killed.
<user_name>, string, optional parameter. If specified, KillAppChildren kills only the instances of the specified application which have been started by the user <user_name>.
Return value
Ret, numeric return code. 0 if the specified application has been killed successfully, 1 if the application has been killed after user confirmation.A negative value is returned if the application could not be killed and script execution stops (unless #IgnoreErrors=1). The possible negative return codes are -3 if the Kill has been cancelled by the user, -4 if the application could not be killed due to an denied access, -1 if the application could not be killed for any other reason.
See also
Example code
The script below launches Notepad, types some text and exits. A dialog box is displayed asking if the document has to be saved. As KillAppChildren is used with the 1 flag, the application Notepad is killed immediately.
Shell("notepad",1)
UseWindow("NOTEPAD.EXE|Edit||1",1)
SendKeys("Hello")
UseWindow("NOTEPAD.EXE|Notepad|",1)
SendKeys("<Alt <F4>>")
KillAppChildren("notepad",1)