Home

Appendix

Application Icon   Triggered Scripts

Triggered scripts are AppleScripts that you attach to an item in DEVONthink (a group or document) and that are executed each time you select the item. Items with attached triggered scripts show an AppleScript icon behind their name.

Using triggered scripts, you can add your own custom behaviors when interacting with items in your database.

Attaching a triggered script

While it's possible to write a script that specifies a triggered script for an item in DEVONthink, the usual method is manually attaching one.

  • Icon
    Select the item you want to attach a script to.
  • Icon
  • Icon
    Click the down arrow next to Script and choose Select. Note the script can be located anywhere, but it must remain in that location for the script to trigger. For convenience, you can create a folder for them in ~/Library/Application Scripts/com.devon-technologies.think3/Menus.

Removing a triggered script

Since a triggered script runs when you interact with the item, it can sometimes be difficult to detach the script, e.g., if a script switches to another application when triggered. For instances like this, to remove a triggered script from an item do the following:

  • Icon
    Control-click the item you want to remove the triggered script from and choose Get Info.
  • Icon
    Click the down arrow next to Script and choose Remove.

Terminology

Triggered scripts are defined by a specific handler: on triggered(var), where var is the variable representing the item the script is attached to.

Example:

on triggered(theRecord)
tell application id "DNtp"
display alert "" & (name of theRecord as string)
end tell
end triggered