Method RunAsWait

AutoIt X

Method Reference


RunAsWait

Runs an external program

RunAsWait "user", "domain", "password", logon_flag, "filename" [, "workingdir" [, show_flag]]

Parameters

username The user name to use.
domain The domain name to use.
password The password to use.
logon_flag 0 = do not load the user profile, 1 = (default) load the user profile, 2 = use for net credentials only
filename The name of the executable (EXE, BAT, COM, or PIF) to run.
workingdir Optional: The working directory.
show_flag Optional: The "show" flag of the executed program:
SW_HIDE = Hidden window
SW_MINIMIZE = Minimized window
SW_MAXIMIZE = Maximized window

Return Value

Success: The PID of the process that was launched.
Failure: see Remarks.

Remarks

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.

The error property is set to 1 as an indication of failure.

Related

Run, RunAsWait, RunWait

Example


Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
oAutoIt.Run "Notepad.exe", "", oAutoIt.SW_MAXIMIZE