Actions: Difference between revisions

From Memento Database Wiki
Jump to navigation Jump to search
mNo edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Stamp|2017-02-25|4.3.0|1.1.0}}
{{Stamp|2023-08-12|5.0|2.0}}
{{BannerMenu}}
{{PageTitle|Actions}}


An '''''Action''''' is a specialized trigger which is initiated by the pressing of a toolbar button while viewing a Library Entries list or an Entry View card; it will be executed in the background mode. Functions and objects that are available for triggers are also available for actions. Action scripts use the same security parameters as trigger scripts.
An '''''Action''''' is a specialized trigger which is initiated by the pressing of a toolbar button while viewing a Library Entries list or an Entry View card; it will be executed in the background mode. Functions and objects that are available for triggers are also available for actions. Action scripts use the same security parameters as trigger scripts.
Line 8: Line 10:
Each library can have multiple actions. To see a script of a specific library, open Library > Menu > Scripts. To create an action:
Each library can have multiple actions. To see a script of a specific library, open Library > Menu > Scripts. To create an action:
# Click <big>'''+'''</big>, and select '''Actions'''.
# Click <big>'''+'''</big>, and select '''Actions'''.
# Select the action context; it can be Library or Entry.<br/>Adding an action to the Libraries List screen or Entry View card will make the button appear in the toolbar.
# Select the action context; it can be Library, Entry or Bulk actions menu<br/>
Adding an action to the Libraries List screen or Entry View card will make the button appear in the toolbar. The button to start a Bulk Action script will be available in the menu, if you select a few entries in the library.


== Arguments (parameters) ==
== Arguments (parameters) ==
Line 15: Line 18:
To create arguments:
To create arguments:
# Open the Action Edit card, move to tab Arguments, and click <big>'''+'''</big>.
# Open the Action Edit card, move to tab Arguments, and click <big>'''+'''</big>.
# To get the values of the arguments, use function arg(argumentName). The type of the result depends on the type of the argument, in similar fashion to the ''field()'' function for an entry.
# To get the values of the arguments, use function ''arg(argumentName)''. The type of the result depends on the type of the argument, in similar fashion to the ''field()'' function for an entry.


== Functions and objects available for the script ==
== Functions and objects available for the script ==
Action scripts can use the same objects and functions as trigger scripts. If the action is in the Library context, then it can use function ''lib()'' to get the current library. If the action is in the Entry context, then it can use function ''entry()'' to get the current entry.
Action scripts can use the same objects and functions as trigger scripts. If the action is in the Library context, then it can use function ''lib()'' to get the current library. If the action is in the Entry context, then it can use function ''entry()'' to get the current entry.


[[Category:Spec]]
For the Bulk Action script, the selected entries are available via ''selectedEntries()'' function.
 
[[Category:en]] [[Category:Spec]] [[Category:Sc]]

Latest revision as of 08:25, 23 August 2023

« Page as of 2023-08-12, editions Mobile 5.0, Desktop 2.0 »

Wiki
Home
About
Wiki | Memento
Getting started
Wiki | Memento
Indexes
Mobile | Desktop | Scripting
Support
Wiki | Memento
Actions

An Action is a specialized trigger which is initiated by the pressing of a toolbar button while viewing a Library Entries list or an Entry View card; it will be executed in the background mode. Functions and objects that are available for triggers are also available for actions. Action scripts use the same security parameters as trigger scripts.

To initiate an action, use the toolbar Action button on the Libraries List screen or on the Entry View card.

Creating an Action

Each library can have multiple actions. To see a script of a specific library, open Library > Menu > Scripts. To create an action:

  1. Click +, and select Actions.
  2. Select the action context; it can be Library, Entry or Bulk actions menu

Adding an action to the Libraries List screen or Entry View card will make the button appear in the toolbar. The button to start a Bulk Action script will be available in the menu, if you select a few entries in the library.

Arguments (parameters)

The script can have arguments, the values of which will be entered by the user.

To create arguments:

  1. Open the Action Edit card, move to tab Arguments, and click +.
  2. To get the values of the arguments, use function arg(argumentName). The type of the result depends on the type of the argument, in similar fashion to the field() function for an entry.

Functions and objects available for the script

Action scripts can use the same objects and functions as trigger scripts. If the action is in the Library context, then it can use function lib() to get the current library. If the action is in the Entry context, then it can use function entry() to get the current entry.

For the Bulk Action script, the selected entries are available via selectedEntries() function.