Run (execute a process)
ts
function Run(commandLine: string): boolean;The Run function spawns a process to execute an external program or script. The command can include parameters as needed.
This function waits for the spawned process to exit, then returns true if it ran without errors, or false if errors occurred.
Examples
Example 1: Run a Windows batch script
ts
if (Run('cmd /c "C:\\my_shell_scripts\\some_script.bat"')) {
Log('Batch script ran successfully');
}Example 2: Run a Linux shell script
ts
if (Run('/bin/bash /home/user/scripts/do_backup.sh')) {
Log('Backup script ran successfully');
}Example 3: Run a program with arguments
ts
if (Run('/usr/bin/convert input.png -resize 200x200 output.png')) {
Log('Image converted successfully');
}