Reminders have several pre-built alarms available for notifications. Reminder scripts are AppleScripts run by an alarm set on a specific reminder for an item. By using or writing your own, you can extend notification possibilities of your reminders. Bear in mind, you can only specify one alarm per reminder.

## Adding an External Script

To add an external script as an alarm for a reminder, choose `Execute External Script`. The next dropdown lists any available AppleScripts, located in the `~/Library/Application Scripts/com.devon-technologies.think/Reminders` directory. Add any of your own scripts to this directory to make them available for any alarm you set.

## Adding an Embedded Script

Sometimes you only need to add a script for a specific purpose, not general use with all reminders. DEVONthink allows you to quickly write an ad-hoc AppleScript specifically for the current reminder.

To write an embedded script for a reminder, choose `Execute AppleScript/JavaScript` as the alarm. Click the … button and a popup will appear with a pre-built handler in place. Add your code as necessary, then press the compile button, the one with the stylized eye, to make sure it compiles correctly. If it does, you will see the code format itself subtly. If not, you will hear a system alert. Click outside the popup to dismiss it. When the alarm goes off, the script will be executed.

Note: When a reminder is set to `Once`, the reminder is removed and the embedded script lost after the alarm goes off. If you have code you'd like to potentially use again, put it in an external script.

## Terminology

Triggered scripts are defined by a specific handler: `on performReminder(theRecord)`, where `theRecord` is the variable representing the item the alarm is set for.

Example:

    on performReminder(theRecord)
        tell application id "DNtp"
            set label of theRecord to 1
            say (name of theRecord as string)
        end tell

    					end performReminder

Debugging Tip: When testing an external reminder script, use the `Once` interval and set the alarm time. Your intuition may be to look at the clock and set the alarm a minute or two ahead. However, if you set the alarm to a time before the current time, it will trigger instantly. This makes for easier testing before you commit to the true interval you'll use.

Pro

If you have external AI set up and a code-compatible model, you can use DEVONthink's Script Assistant. Choose the AI model and enter a description of the desired script in the prompt field, then press the `↩︎` Return key to compose and refine a script.