###Function###
RunWait

###Description###
Runs an external program and pauses script execution until the program finishes.

###Syntax###
RunWait ( "filename" [, "workingdir" [, flag]] )


###Parameters###
@@ParamTable@@
filename
	The name of the executable (EXE, BAT, COM, PIF) to run.
workingdir
	[optional] The working directory.
flag
	[optional] The "show" flag of the executed program:
	  @SW_HIDE = Hidden window
	  @SW_MINIMIZE = Minimized window
	  @SW_MAXIMIZE = Maximized window
@@End@@

###ReturnValue###
@@ReturnTable@@
Success:	Returns the exit code of the program that was run.
Failure:	Depends on RunErrorsFatal; see Remarks.
@@End@@


###Remarks###
To run DOS commands, try <i>RunWait(@ComSpec & " /c " & "commandName")</i>

After running the requested program the script pauses until the program terminates.  To run a program and then immediately continue script execution use the Run function instead.

Some programs will appear to return immediately even though they are still running; these programs spawn another process - you may be able to use the ProcessWaitClose function to handle these cases.

By default the script will terminate with a fatal error if the Run function fails.  To set @error to 1 as an indication of failure, see AutoItSetOption.

###Related###
ProcessWait, ProcessWaitClose, RunAsSet, RunErrorsFatal (Option), Run


###Example###
@@IncludeExample@@
