Action.run()
Overview
Starts the Windows executable with the provided parameters and runs the provided function when the program exits.
Windows only.
Added in version 2.1.16
Format
Action.run(executable, parameters, callback);
Parameters
Value | Description | Type | Required | Notes |
---|---|---|---|---|
executable | A string with the executable path. | String | Required | Must be the exact path. |
parameters | Options given when starting the executable. | String | Optional | |
callback | The function called when the executable is closed. | function | Optional | Passes in the exit code from the closed executable as a parameter. |
Example
Copy
/* Starts Notepad.
Opens file "C:\\Users\\john\\Desktop\\test.txt".
Displays exit code in a toast on program exit.
*/
Action.run(
'C:\\Windows\\System32\\notepad.exe',
'C:\\Users\\john\\Desktop\\test.txt',
function (exitCode) {
View.toast('Process ended. Exit code: ' + exitCode, true);
}
);