Application icon

Flow Control in Actions

By default an action executes from its first statement until its last statement is done and then it returns. If the action was called by another action it will resume processing after the calling statement.

The above statement is a simplification as obviously the current and previous execution modes, Stepwise or Grouped also affect what happens when you return. When you return from an action running Stepwise you will still be running Stepwise. When you return from an action running Grouped the previous execution mode will be continued. For example, if Stepwise action A calls Grouped action B, the execution mode will be set to Stepwise when B returns. However, if Grouped action C calls Grouped action D, the execution mode will be still be Grouped when D returns.

Yate maintains a single global action test state. The action test state is set or cleared by various statements and can be manually set via the Set Action Test State function. The action test state is only automatically reset to False when a UI based action starts or when the Batch Processor is about to process a new folder.

The most basic flow control statement is the standard if - else - endif construct. In Yate, the if statement tests if the action test state is true or false. The if-else-endif construct allows you to selectively execute action statements. The construct can also automatically adjust which files are active by testing a track variable as opposed to the action test state.

Actions may invoke other actions. The Run statement is used to unconditionally execute another action.

The Test function allows you to test the current action test state and based on the results of the test optionally execute another action. You can then optionally Exit (return from the current action) or Stop (terminate all action processing).

The Load & Run statement will load an audio file and execute an action against the file. This statement is only valid while batch processing.

Exit is a stand alone function which conditionally performs an effective return at a specific location in the action.

Stop, Stop Batch Processing and Cancel statements all conditionally terminate action processing, regardless of how many nested actions are running.

The Repeat With statement can be used to successively call an action, setting a variable to successive portions of a field. Think of it as successively processing all elements in a list.

The Repeat For statement can be used to call an action a specified number of times, setting a variable to the current index.

The Repeat Forever statement can be used to repeat until potentially stopped by an Exit Grouped statement or an Exit Repeat, Stop, Stop Batch Processing or Cancel statement.

The Next File statement conditionally stops the execution of the current action and proceeds to processing the next file to be processed. While executing Stepwise, the function is identical to the Exit function. While executing Grouped, the function essentially successively returns to the outermost called action which can begin processing the next file.

The Exit Grouped statement conditionally stops the execution of all actions being run Grouped. While executing Stepwise, the function is identical to the Exit function. While executing Grouped, the function essentially successively returns to the outermost action running Stepwise. If all actions are being run Grouped, action processing will terminate.

The Exit Repeat statement conditionally exits the current action. If the action is being directly run by a Repeat For, Repeat Forever or Repeat With statement, it will stop the current repeat sequence.

The Break statement conditionally exits the current action, regardless as to how it was called or whether the execution mode is stepwise or grouped. The next statement to be executed is always the statement immediately following the caller.

The Restart Repeat Forever statement conditionally stops the execution of the current action (regardless of execution mode), and flushes the call stack until it finds the last started Repeat Forever statement. If found, the Repeat Forever's action's first statement will be the next to execute. If not found, this statement is equivalent to Stop. The statement can be executed always or only if the action test state is true or false.

The Break, Exit, Exit Grouped, Exit Repeat, Next File and Restart Repeat Forever statements can optionally set the action test state to true or false if the statement is executed.

For a detailed explanation as to how actions execute:

    How Actions Execute