mail.app: bugs with "outgoing message" and "set theReply to reply ..."

Hello,

I wonder why I cannot find any information on google regarding these problems, as I think it should be quite a common task for scripting:
I wanted an applescript to:

  1. reply a selected message
  2. change the subject appending a certain word

Should be easy, isnt it?!

Well, look at this


tell application "Mail"
	set sel to selection
	set theMessage to the first item of sel
	set theReply to reply theMessage
	get subject of theReply
end tell

Error: The variable theReply is not defined.
Uhuh, well, so it sort of looses the reference to the fresh reply.
No problem, let´s get it through “outgoing messages”:


tell application "Mail"
	set outMes to outgoing messages
       get outMes
end tell

result: {application “Mail”, application “Mail”, application “Mail”, application “Mail”, application “Mail”}

Dont even try to access something like “get subject of firrst item of outMes” or the like.
I cannot even think of what happened here.

Very interesting. The only way to get a veritable “outgoing message” seems to be to “set foobar to make new outgoing message with blabla” BUT this will not work for assembling a reply because you cannot get the content of the selected message if there is anything but plaintext in it.

Uhm, Apple, excuse me, are you guys at the mail.app department smoking to many iPots or something?

Anybody any help? Thanks a lot in advance …
AppleScript v1.10
Mail.app 2.0.3
Mac OS 10.4.2

lucas

I’m having the same problem. I sent a bug report to Apple.

I have no solution to this problem, only more information.

Neither of the commands forward nor reply return a value. They are supposed to return a reference to the outgoing message that they create.

The reference “outgoing messages” or equivalently “every outgoing message,” returns a list of n items, each of which is a reference to the application “Mail.” The count, n, is 1 + the real number of outgoing messages.

The reference “outgoing message i” does not return a result even when outgoing message i or outgoing message i - 1 exists.

I won’t speculate on what the root of these problems is. They’re apparently all related.