Adding scripts

Each Library may include any number of scripts — pieces of automated code that is going to be executed on a certain event. Using scripts, you can add complex calculations, add, update or edit the entries, change the data any way you wish.

There are two types of scripts available in Memento Database: Triggers and Actions. The main difference is when the script is executed. For Triggers, you need to define an event which will launch the script like Editing or Updating an entry, Opening the Library, etc. Actions are activated by clicking the relevant icon on the toolbar of the Library. The more Actions you add, the more icons will be shown for a Library user.

To start working with scripts, go to the context menu of the Library and choose Scripts option or evoke it from Edit menu while the Library is selected. The new window will be opened:

Adding a new script

  1. Toolbar allows you to work with a script:
    • Add Add a new Trigger or Action
    • Remove Remove the selected Trigger or Action
    • Run Run (execute) the selected Trigger or Action
  2. Sidebar gives access to all Triggers and Actions of the Library and allows you to adjust Permissions. As for scripts may launch extraordinary actions, you should define whether you permit a script to, for example, rewrite the data, influence one or more Libraries, etc. Note that permissions should be adjusted for each device on each the script is executed.
  3. Code panel allows you to adjust the events when the selected Trigger is started, add arguments for an Action, include additional JavaScript Libraries and finally add the lines of code for your script.
  4. Once the script is ready, click OK to save the changes.

The syntax used in Memento Database is similar to JavaScript. There are numbers of special functions and objects created especially for working with Libraries and Entries. Visit wiki to find the detailed information about syntax features or view the examples.

Was this article helpful?

Related Articles