Scripting Mail, differences between v 1.0 and 2.0 ?
Scripting Mail, differences between v 1.0 and 2.0 ?
- Subject: Scripting Mail, differences between v 1.0 and 2.0 ?
- From: Jay Louvion <email@hidden>
- Date: Wed, 28 Dec 2005 15:20:31 +0100
Title: Scripting Mail, differences between v 1.0 and 2.0 ?
Hi all,
I’m trying to get all the incoming mail in both Mail 1.0 (on a Panther running server) and Mail 2.0 (on a my dev. PowerBook) to go through an AppleScript. This is the piece of code I’v picked up for the time being, but it only seems to work correctly with selected emails, not when I ask a rule directed at all incoming emails to run applescript (which I imagine is the way things should be done, right ?) - in this case, nothing happens at all.
using terms from application "Mail"
on perform mail action with messages incomingMessages
try
tell application "Mail"
repeat with msg in incomingMessages
set contentString to (content of msg) as string
set theSubject to subject of msg
tell me to set eventData to textToList(contentString, tab)
end repeat
end tell
set EventDate to item 1 of eventData
set EventStartTime to item 2 of eventData
set EventEndTime to item 3 of eventData
set EventRecurrence to item 4 of eventData
set Photographer to item 5 of eventData
set JobNr to item 6 of eventData
set JobStatus to item 7 of eventData
set eventName to item 8 of eventData
set ClientFirstName to item 8 of eventData
set ClientLastName to item 9 of eventData
set ClientCellPhone to item 10 of eventData
set EventDescription to item 11 of EventDate
--TESTING (comment out when debugging done)
display dialog Photographer & space & ClientLastName & space & JobNr
--TESTING (comment out when debugging done)
on error mistake
display dialog mistake
end try
end perform mail action with messages
on run
tell application "Mail" to set sel to selection
tell me to perform mail action with messages sel
end run
on textToList(thisText, delim)
set resultList to {}
set {tid, my text item delimiters} to {my text item delimiters, delim}
try
set resultList to every text item of thisText
set my text item delimiters to tid
on error
set my text item delimiters to tid
end try
return resultList
end textToList
end using terms from
TIA for any help,
Best,
J.
Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva
T+4122 840 3272
F+4122 840 3271
skypeme:
jaylouvion
www.studiocasagrande.com
P Please consider the environment before printing this email.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden