To initiate a script action, use the toolbar button on the libraries list screen or the toolbar on the entry edit card.
A script action is a specialized trigger which is initiated by the pressing of a button and executed in the background mode. Functions and objects that are available for triggers are available for script actions. Script actions use the same security parameters as trigger scripts.
Creating a script action
Each library can have multiple script actions. To see a script of a specific library, open Library > Menu > Scripts. To create a script action:
- Open the list of scripts, click the +, and select Actions.
- Select the place of script (context); it can be library or entry.
Adding a script action on the toolbar of the library or entry card will make the button appear.
The script can have arguments, the values of which will be entered by the user.
To create arguments:
- Open the script edit card, move to tab arguments, and click +.
- To get the values of the arguments, use function arg(argumetn name). The type of the result depends on the type of the argument, and is similar to the field() function for an entry.
Functions and objects available for the script
Script actions can use the same objects and functions as trigger scripts. If the script is in the Entry context, then it can use function entry() to get the current entry.