• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mail Rule Scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail Rule Scripts


  • Subject: Mail Rule Scripts
  • From: James Roberts <email@hidden>
  • Date: Sat, 22 Jan 2011 20:41:49 -0500

Hi Folks,

Wonder if you could help out a real Newboob to applescript.

I want to create a new todo based on a Mail Rule. I have created the rule and made sure it is working (changed background colour). The script compiles and saves fine but when the rule runs no new todo is created. As well as pointing out were I went wrong with my script could you give me an idea on how to debug this sort of thing. The script compiles find, but clearly has a problem, is there a way of stepping through the rule to see were it hiccups?

on perform_mail_action(CreateTodo)
tell application "Mail"
set theSelectedMessages to |SelectedMessages| of CreateTodo
set theRule to |Rule| of CreateTodo
repeat with a from 1 to count theSelectedMessages
set fromMsg to (sender of thisMessage as string)
set subjMsg to (subject of thisMessage as string)
set todoMsg to fromMsg & subjMsg
tell application "iCal"
tell calendar "Mail To Do"
set theDueDate to (current date)
make new todo at end with properties {summary:todoMsg, due date:theDueDate}
end tell
end tell
end repeat
end tell
end perform_mail_action

As you probably can tell I cobbled this together from several online sources. I tested parts of it individually, but the whole thing just does no work.

Looking forward to the critique (flames are acceptable :-(
Jimmy Roberts
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Mail Rule Scripts
      • From: Matthew Smith <email@hidden>
    • Re: Mail Rule Scripts
      • From: James Roberts <email@hidden>
    • Re: Mail Rule Scripts
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: localized string and 10.6
  • Next by Date: Re: Mail Rule Scripts
  • Previous by thread: Re: AppleScript to automatically paste clipboard image to a file.
  • Next by thread: Re: Mail Rule Scripts
  • Index(es):
    • Date
    • Thread