• 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
Re: Mail Rule Scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail Rule Scripts


  • Subject: Re: Mail Rule Scripts
  • From: James Roberts <email@hidden>
  • Date: Mon, 24 Jan 2011 09:35:24 -0500



To: email@hidden
Subject: Re: Mail Rule Scripts


on perform_mail_action(CreateTodo)
tell application "Mail"
set theSelectedMessages to |SelectedMessages| of CreateTodo


Make this the first line of the scrappy:

using terms from application “Mail”


Thanks Michelle,

Didn’t fix the problem though. 

There are several problems in this script:
1. theRule is not used.
2. The variable a is not used within the repeat loop.
3. thisMessage is used but not set to anything.

Try:
using terms from application "Mail"
on perform mail action with messages messageList
tell application “Mail”
               end tell
       end perform mail action with messages
end using terms from
Matthew Smith

With a lot of help from the list I have my script working. The script open iCal and adds the new todo with the required information in the proper place.
However I do not use iCal very often and BusyCal does not support scripts (yet?). So I delay 1 min and then quit iCal. My question is, were should I place my quit command? Inside the using terms but outside the repeat, or outside the using terms. What are the system impacts to either place. Or should I find some way of actually checking iCal process (shell script?) and killing it off after is stopped processing the msgs. Longer term I am going to try and create the todo using Mail (just have to figure out the msg structure, I think) and have no need to kill anything.

using terms from application "Mail"
on perform mail action with messages messageList
tell application "Mail"
repeat with a from 1 to count of the messageList
set msgId to (message id of item a of messageList)
set msgUrl to "message:<" & msgId & ">"
set fromMsg to (sender of item a of messageList as string)
set subjMsg to (subject of item a of messageList as string)
set todoMsg to fromMsg & subjMsg
tell application "iCal"
tell calendar "Mail To Do"
set theDueDate to (current date) + 5 * days
make new todo at end with properties {summary:todoMsg, due date:theDueDate, priority:high priority, url:msgUrl}
end tell
end tell
end repeat
(*tell application "iCal"
delay 60
quit "iCal"*)
end tell
end perform mail action with messages
end using terms from
(*tell application "iCal"
delay 60
quit
end tell*)


 _______________________________________________
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

References: 
 >Re: Mail Rule Scripts (From: James Roberts <email@hidden>)

  • Prev by Date: getting focus, slow getting icon position in window
  • Next by Date: Re: getting focus, slow getting icon position in window
  • Previous by thread: Re: Mail Rule Scripts
  • Next by thread: Re: Mail Rule Scripts
  • Index(es):
    • Date
    • Thread