I’m trying to create a Mail Rule that makes a new reminder whenever I get a payment notification from my internet provider. This AppleScript works when run directly or as a step in a Keyboard Maestro macro:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set remName to "Xfinity bill"
set remNotes to "https://customer.xfinity.com/#/billing"
tell application "Mail"
set selectedMsgs to the selection
repeat with theMsg in selectedMsgs
set msgDate to date received of theMsg
set remDate to msgDate + 5 * days
set hours of remDate to 10
set minutes of remDate to 0
set seconds of remDate to 0
tell application "Reminders"
tell list "Expenses"
make new reminder with properties {name:remName, remind me date:remDate, body:remNotes}
end tell
end tell
end repeat
end tell
It creates a reminder in the Expenses list with the “remind me” date I want.
Of course, I don’t want to run this by hand; I want it run automatically through a Mail Rule. But setting a Mail Rule to run this nearly identical script fails.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set remName to "Xfinity bill"
set remNotes to "https://customer.xfinity.com/#/billing"
using terms from application "Mail"
on perform mail action with messages theMessages
repeat with msg in theMessages
set msgDate to (get date received of msg)
set remDate to msgDate + 5 * days
set hours of remDate to 10
set minutes of remDate to 0
set seconds of remDate to 0
tell application "Reminders"
activate
tell list "Expenses"
make new reminder with properties {name:remName, remind me date:remDate, body:remNotes}
end tell
end tell
end repeat
end perform mail action with messages
end using terms from
Through some judiciously placed display dialog
commands, I can tell that it fails when it tries to make a new reminder.
I suspect this has to do with privacy and permissions in Catalina. I opened the Privacy tab in the Security & Privacy preferences and tried to give Mail permission to access Reminders. But there’s no obvious way to add an app to the list.
As you can see, there’s no + button for adding an app. Dragging the Mail.app icon from Applications to the list doesn’t work, either.
Googling has led me nowhere. What am I missing?