Synchronous and Asynchronous functions

External programs launched from toolbar buttons and hotkeys can be either synchronous or asynchronous.

 

As a simple example of the difference, take a command that runs Notepad and passes it the name of the selected item:

    notepad.exe {f}

 

If only one file were selected when you ran this command, Notepad would open showing the selected file, and that would be that. If, however, three files were selected when you ran the command, the behaviour would vary:

 

By default, a function that contains a single command will run asynchronously, and functions that contain two or more commands will run synchronously. You can override this in several ways:

 

Internal commands always run synchronously - Opus will always wait for an internal command in a function to finish before moving on to the next instruction. If you want to run an internal command asynchronously for some reason, you can run it using the DOpusRT command (i.e. dopusrt /cmd) - it then behaves as an external program, and will respect the @sync and @async modifiers.