runSubprocess

A function that can be used in Scripting.

Syntax and semantics

runSubprocess (executableFilePath$, ...)
run the program given by the (relative or absolute) executableFilePath$, with optional arguments given in “...”.

If the subprocess fails in its execution, runSubprocess will report the subprocess’ error message and stop the script.

Examples

writeInfoLine: “start”
runSubprocess: “C:\\Windows\Notepad.exe”
appendInfoLine: “end”

This script will write “start” into the Info window, then start up Notepad.exe, wait until you close Notepad, and only then write “end” into the Info window. That is, the subprocess is run synchronously.

You can use asynchronous in combination with runSubprocess:

writeInfoLine: “start”
asynchronous runSubprocess: “C:\\Windows\Notepad.exe”
appendInfoLine: “end”

This script will write “start” into the Info window, then start up Notepad.exe, and then immediately write “end” into the Info window. Whatever you subsequently do in Notepad (including closing that app) will have no influence on your script or on Praat in general.

For some more details and examples, see Scripting 6.5. Calling system commands.

Links to this page


© Paul Boersma 2023,2026