r/applescript • • Jul 14 '20

Mail AppleScript to create a Reminder

In Mail app you can create a rule to trigger an Apple Script. I'm new to scripting, but trying to figure out if there is a way to have it create a reminder but input the subject of the email which triggered it into the notes of the reminder.

This is what I currently have( I found this online, so if there is now a better way to do this please let me know). Look at last line where it is all in CAPS...

use AppleScript version "2.4" -- Yosemite (10.10) or later

use scripting additions

on makeReminder(reminderName, reminderBody, reminderDueDate, reminderListName)

tell application "Reminders"

if not (exists list reminderListName) then

make new list with properties {name:reminderListName}

end if

-- See if there is an existing reminder. This could happen if the rule was accidently

-- trigged more than once.

set existingReminder to reminders where due date = reminderDueDate and name = reminderName

if existingReminder is {} then

-- No existing reminder found, create one...

return make new reminder ¬

with properties {name:reminderName, body:reminderBody, due date:reminderDueDate} ¬

at list reminderListName

end if

return missing value

end tell

end makeReminder

set today to current date

set tomorrow to today + 60 * 60 * 24 -- + 1 day

makeReminder("Record Lapsed Member", "HERE I WOULD LIKE THIS NOTE TO BE OF THE SUBJECT", today, "Oranization name")

5 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/thefarside2019 Apr 16 '23

Hi, I know this was 3 years ago but hoping your or another member can assist.

With your script above, what do I need to change to make it work on my system? Do I need to modify any of the above code or variables?

I tried it as-is but nothing happens.

I'm on MacOS Ventura 13.2.1