Mail.app: set content of message generates unexpected error
Mail.app: set content of message generates unexpected error
- Subject: Mail.app: set content of message generates unexpected error
- From: Matthew Rothenberg <email@hidden>
- Date: Mon, 27 Oct 2003 17:13:49 -0500
I have been able to successfully make a number of applescripts that act upon
the content of incoming messages in Mail.app via Rules. What I want to be
able to do is use these to do things like stripping certain characters, etc.
(In particular, I want to remove the pagelong disclaimer that gets appended
to every email my girlfriend sends me).
I can get to the point where I have a string containing the "santized"
message text. My problem is getting that text to replace the existing
message text. Despite "content" in class "message" not being listed as
read/only, Mail.app generates an error when I try to set it.
I am using code that looks somewhat like this
>
using terms from application "Mail"
>
on perform mail action with messages theMessages for rule theRule
>
tell application "Mail"
>
repeat with eachMessage in theMessages
>
[...snip...]
>
set the content of eachMessage to newTxt
>
end tell
>
end perform
>
end using terms from
And it ends up dumping an error that looks like this:
>
set content of message 2 of mailbox "INBOX" of account "NYU CAT" to
>
"testing..."
>
"Mail got an error: NSInternalScriptError"
Not a very helpful error message I know.
Caveat: I can set other properties of the message object just fine,
changing the read status (bool) or subject (plain text) work just fine, and
the change is reflected instantly in Mail.app. The problem seems to only
happen when I attempt to set the content property.
I've wasted an entire day on what should have been a simple script... Any
help is appreciated!
FWIW, this is in OSX10.3.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.