# Run External Script

This function is used to run a Mac OS X script.

You specify the script name. Note that a full path is typically required. You also specify which parameters are to be passed to the script. You can quickly choose from None, a path to an audio file or a path to a folder containing an audio file. Alternately, you can select Custom and choose as many parameters as you wish. In addition to the path and folder you can also pass the contents of track variables.

Note: due to the nature of the command, when a full path is specified it must be absolute. If you want a path relative to the home folder, use the \h escape sequence as opposed to ~.

> use
> \h/Downloads/scriptfile
> not
> ~/Downloads/scriptfile

The script name may contain any of the escape sequences described in Escape Sequences.

If the filename extension of the script is .yatesh, Yate will set the file's attributes to ensure that it can be executed. With this capability scripts can be created on the fly in actions.

You can elect to have the script run only once per set of files. Note that the single result will be saved to all files when this option is specified. The Run once option is only meaningful when executing stepwise. When this option is not set, the script will be run once for every selected track when running stepwise.

If the script cannot be launched the action will be cancelled.

Error handling is controlled by options which may be interpreted differently on whether you are running batched or not.

The termination status code from the script is saved to named variable External Script Result Code.

When not running batched, if any data is written to stderr, it will be displayed in an error message. You can choose to continue or cancel. If Ignore errors is specified, an error message will not be displayed. The contents of stderr will be saved to the External Script stderr Output named variable. If no error has occurred, the named variable will be cleared.

When running batched, an error will be posted to the log file and the action will continue. If you wish to test for errors you can select the Ignore errors option.

Note that the External Script stderr Output and External Script Result Code named variables are set or cleared each time a script is run. The values may be meaningless when running stepwise if the Once option is not set.

While intended for batched execution, the Stop action on script error option will always work and will stop interactive and/or batch processing.

The output of the script will be placed into the specified track variable.