Can anyone tell me why this script, that’s triggered by a Mail rule, isn’t working?
The Mail rule sets a background colour, sets a flag, then runs the applescript below:
-- Web stuff reminder script --
--
-- This script creates reminders for web stuff.
-- It's triggered by an email (via Mail), and creates a reminder based on the V number of the item that's gone to print.
-- Note that the script uses a Mail rule to activate
-- Process is:
-- Get the V number from the subject email
-- Create a reminder in Reminders with the name of the email subject line
on perform_mail_action(info)
tell application "Mail"
if read status of theMessage is false then
if frontmost then return -- don't announce if Mail is frontmost
set selectedMessages to |SelectedMessages| of info
repeat with theMessage in selectedMessages
set theSubject to subject of theMessage
end repeat
end if
end tell
-- ALL DONE!
-- Now create some reminders - one for each of the different vendors
-- IMPORTANT! YOU MUST HAVE A REMINDER LIST TITLED "Web Stuff" OR THIS PART OF THE SCRIPT WILL FAIL
tell application "Reminders"
activate
my create_reminder(theSubject)
end tell
end perform_mail_action
-- START SUBROUTINES --
-- ******************************************************************
on create_reminder(reminderTitle)
tell application "Reminders"
tell list "Web Stuff"
make new reminder with properties {name:reminderTitle}
end tell
end tell
end create_reminder
-- ******************************************************************
I’ve read a few posts that say script triggers are broken in Mail under Mountain Lion “ but also plenty that have said it works!