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