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 |