Re: Mail crashing on mail action when getting content
Re: Mail crashing on mail action when getting content
- Subject: Re: Mail crashing on mail action when getting content
- From: Philip Aker <email@hidden>
- Date: Wed, 25 Jun 2008 18:12:53 -0700
On 08-06-25, at 18:00, Alan Fairlie wrote:
Thanks for the replies but l couldn't get it working with these
suggestions.
It seems the only way l can get the content of an email is using
'selection' which defeats the purpose of a mail rule.
I'm running on Leopard by the way.
I don't think you can use 'display dialog' inside a Mail rule because
Mail runs these rules on a secondary thread and UI can only be run in
the main thread. Write what you need to a file for the purposes of
debugging.
On 23/06/2008, at 9:09 PM, Peter Baxter wrote:
Hi Alan,
I have been having the same problem with a script that reads the
contents of each new email as it arrives. I haven't had time to
write the script, but I was thinking that I may be able to pass the
message to another application like Finder or system events to
avoid the crash that inevitably occurs when two mail messages
arrive at the same time. The resulting script (untested) would
look like this:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
set theSubject to subject of item 1 of theMessages
set theContent to content of item 1 of theMessages
set theText to "Subject: " & theSubject & return & "Content: " &
theContent
--> tell application "System Events"
display dialog theText
--> end tell
end tell
end perform mail action with messages
end using terms from
On 23/06/2008, at 6:51 PM, Detlef Schulz wrote:
Hi,
contents of is also a way of dereferencing in AppleScript, so
there might be conflict here with the contents property of a mail
message. Try if the target specifier its works:
set theContent to its content of item 1 of theMessages.
Detlef
Am 23.06.2008 um 10:00 schrieb Alan Fairlie:
The following script causes Mail to crash when a mail rule calls
the script.
It works fine if l remove - set theContent to content of item 1
of theMessages.
Is this a bug or is there another way to get the content of an
email via a mail rule?
Thanks, Alan.
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
set theSubject to subject of item 1 of theMessages
set theContent to content of item 1 of theMessages
set theText to "Subject: " & theSubject & return & "Content: "
& theContent
display dialog theText
end tell
end perform mail action with messages
end using terms from
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
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