## Run Application

This function is used to run Mac OS X applications. Applications can be launched with command line parameters (Launch), or can be passed files to open as in the Finder's Open With menus (Open With).

The specified path may contain any of the escape sequences described in Escape Sequences. After unescaping, if the path is not absolute (/) or relative to the home folder (~/), Yate will attempt to locate the application by name.

The Silent option controls what happens when an eror is detected. Regardless of the setting's value, the statement terminates if an error occurs. If Silent is not set, an error message is displayed and action processing will terminate. If Silent is set, the action test state will be set to false and the named variable Action Error Text will contain an error message. If no errors are detected, the action test state will be set to true.

When the operational mode is Launch, the Unique option specifies what to do if the application is already open. If Unique is set an attempt will be made to launch a new instance of the application.

The following modes of operation are available:

Launch - None
  The application will be launched with no parameters. Warning: You should set the Once option or when running stepwise multiple launches will occur.
Launch - File
  The application will be launched with a single parameter which is the full path to an audio file. When running stepwise, the application will be launched once for each file in the current selection, unless the Once option is specified, in which case only the first file will be processed.
Launch - Folder
  The application will be launched with a single parameter which is the full path to an audio file's containing folder. When running stepwise, the application will be launched once for each file in the current selection, unless the Once option is specified, in which case only the first file will be processed.
Launch - List
  A specified named variable contains zero or more list items separated by the default list delimiter (\~). The application is launched with the list items as command line arguments. The named variable text field may contain any of the escape sequences described in Escape Sequences.
Open With - File
  An Open With message will be sent to the application for every file in the current context. That means a single file when executing groupwise and multiple files when running stepwise.
Open With - List
  A specified named variable contains zero or more list items separated by the default list delimiter (\~). The named variable text field may contain any of the escape sequences described in Escape Sequences. Items in the list must be full paths to files. Items which do not start with a / are ignored. An Open With message will be sent to the application for every item in the list. You are not restricted to opening audio files. Files of any type, (m3u, m3u8, txt, etc.) can be passed to the application. How any given application will respond to a file type that it cannot process is beyond our control.

Note that not all modes will work with all applications. It is possible that the launch method will work and Open With will not, or vice versa, or neither. You may have to try various methods to find the one where the parameters are successfully processed by the application. Most UI based Mac applications have a better chance with the Open With method.

Warning: You cannot pass parameters to a compiled AppleScript. The formatting of passed parameters is not the same for AppleScript as in standard OS X applications. If necessary, you can pass the parameter via the clipboard.