< Previous | Contents | Manuals Home | Boris FX | Next >

System call arguments

The system call has three modes, determined by the dontwait argument: - 1 (compatibility), 0, and 1. With no third argument, compatibility mode is selected. If thereThe system call should be a single command on Windows, plus arguments. Use double-backslashes and quotes as appropriate: “C:\\temp\\My Folder\\foo”, which can be tricky. See Windows system and CreateProcess references for details.

WARNING : erroneous system commands can damage or destroy any file in your computer!

In compatibility mode (dontwait of -1), the command is turned into

<cmd.exe /C "cmd"> and then run. (The angle brackets are in lieu of quotes.) A console window will appear, and the command(s) will be run and finished before SynthEyes continues execution, with the exit code as the return value of the system() subroutine call. This mode is mostly intended for compatibility with scripts before SynthEyes 1311.

With dontwait of 0, the command cmd is passed to Windows for execution and must be a single command line, ie start with the name of an executable.

SynthEyes will wait for the command to finish execution, and system() will return the exit code.

In dontwait of 1, the command cmd is passed to Windows for execution and must be a single command line, ie start with the name of an executable. SynthEyes will not wait for the command to finish execution, and system() will return zero.

In mode 0 and 1, you might pass your command as <cmd.exe /C " cmd">. That will start a console window. Or use <cmd.exe /c "start /b\" cmd\""> l to start a console application without a visible console.

On Mac OS X and Linux, the command line is passed to the system's "system" call for execution. If a directory dir is present, the command line is prefixed with <cd " dir"; > and if the dontwait argument is 1, the command line is suffixed with < &>. System() returns the exit code of the underlying system call.

In all of these cases, Windows, Mac, and Linux alike, quoting and escaping are tricky. Please be sure to quote all file names so that embedded spaces do not result in a failure. See afterscript.szl for an example.

Note that there is always a 0 or 1 return value, you must do something with it to prevent it from being included in the output file. (For example, test it or assign it to a dummy variable.)


©2023 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.