Runs an external program using the ShellExecute API and pauses script execution until it finishes.
ShellExecuteWait ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )
Parameters
| filename | The name of the file to run (EXE, .txt, .lnk, etc). |
| parameters | [optional] Any parameters for the program. Blank ("") uses none. |
| workingdir | [optional] The working directory. Blank ("") uses the current working directory. |
| verb | [optional] The "verb" to use, common verbs include: open = Opens the file specified. The file can be an executable file, a document file, or a folder edit = Launches an editor and opens the document for editing. If "filename" is not a document file, the function will fail print = Prints the document file specified. If "filename" is not a document file, the function will fail properties = Displays the file or folder's properties See remarks for more information on the default behavior when a verb is not specified. |
| showflag | [optional] The "show" flag of the executed program: @SW_HIDE = Hidden window @SW_MINIMIZE = Minimized window @SW_MAXIMIZE = Maximized window |
Return Value
| Success: | Returns the exit code of the program that was run. |
| Failure: | Returns 0 and sets @error to non-zero. |
Remarks
After running the requested program the script pauses until the requested program terminates
Related
ShellExecute, Run, RunWait, RunAs, RunAsWait
Example
$val = ShellExecuteWait("Notepad.exe")
; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)