File.Run

number File.Run ( 

string  Filename,

string  Args = "",

string  WorkingFolder = "",

number  WindowMode = SW_SHOWNORMAL,

boolean WaitForReturn = false )

Example 1

File.Run("AutoPlay\\Docs\\setup.exe", "/w", "", SW_MAXIMIZE, true);

Runs "AutoPlay\Docs\setup.exe", passes it /w as a command line argument, tells it to open with its window maximized, and waits for setup.exe to exit before continuing with the next action.

Example 2

File.Run("notepad.exe", "AutoPlay\\Docs\\readme.txt", "C:\\Temp", SW_SHOWNORMAL, true);

Runs notepad.exe and opens "AutoPlay\Docs\readme.txt" in it. Specifies C:\Temp as the working directory, tells notepad to open with its normal window size and position, and waits for the user to close notepad.exe before continuing.

Example 3

-- Confirm that the installation executable should be launched.
result = Dialog.Message("Confirm", "Are you sure you would like to install now?", MB_YESNO, MB_ICONINFORMATION, MB_DEFBUTTON1);

-- If the user clicked the Yes button.
if (result == IDYES) then

    -- Run the installation file.
    File.Run("AutoPlay\\Docs\\setup.exe", "", "", SW_SHOWNORMAL, false);

    -- Check to see if an error occurred when launching the file.
    error = Application.GetLastError();

    -- If an error occurred, display an error message to the user.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end
end

Asks the user if they would like to run the installation file. If they click the Yes button, the installation file will be launched using the File.Run action. If the action fails, the error code message is displayed in a dialog message.

See also:  Related Actions