Runs an external program and pauses script execution until the program finishes.
RunWait ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )
| program | The full path of the program (EXE, BAT, COM, or PIF) to run (see remarks). |
| workingdir | [optional] The working directory. This is not the path to the program. |
| show_flag | [optional] The "show" flag of the executed program: @SW_HIDE = Hidden window (or Default keyword) @SW_MINIMIZE = Minimized window @SW_MAXIMIZE = Maximized window |
| opt_flag | [optional] Controls various options related to how the parent and child process interact. 0x10000 ($RUN_CREATE_NEW_CONSOLE) = The child console process should be created with its own window instead of using the parents window. This flag is only useful when the parent is compiled as a Console application. |
| Success: | Returns the exit code of the program that was run. |
| Failure: | Returns 0 and sets @error to non-zero. |
Local $val = RunWait(@WindowsDir & "\notepad.exe", @WindowsDir, @SW_MAXIMIZE)
; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)