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
Mail.app "reply" verb returning nothing
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
Mail.app "reply" verb returning nothing
Subject
:
Mail.app "reply" verb returning nothing
From: Dylan McNamee <
email@hidden
>
Date: Tue, 2 Jan 2007 12:49:45 -0800
I'm a long-time Mac user and programmer, but AppleScript has always vexed me.
Thanks to FastScripts, I've decided to try my hand at it again, and wrote this script as the beginning of a macro to auto-reply to Kagi purchase emails.
Here's my problem:
If I want to create a reply to a message I have in hand, there's no easy way to convert the "sender", which is a wackily formatted string into a "recipient" which is a pair of name, email address. Gaah.
Mail.app's applescript verb "reply" leverages Mail's complex logic for transforming sender's into recipients, however I either found a bug in reply, or I'm totally clueless as to how this script stuff should work. The Mail.app dictionary for reply says it returns an outgoing message.
Here's a snippet that shows the problem: (select a message in your viewer, then run the script)
tell application "Mail"
activate
set viewer to message viewer 1 -- it took Google to tell me I needed the "1" here...
tell viewer
set msgs to selected messages
set msg to first item of msgs
end tell
set myReply to reply msg with opening window
if myReply is false then
"empty reply?!"
else
"ok"
end if
end tell
When I run this script, I get an AppleScript error: "The variable myReply is not defined." The reply verb's documentation says it returns an outgoing message, but it seems to have returned nothing (not even false!).
Am I doing something wrong, or is this a bug in the reply verb? If it's the latter, I'm happy to file a bug report (while grumbling loudly because this kind of thing seems to happen every time I try AppleScript).
cheers! dylan
ps: apologies if this is a duplicate, I just realized I have to subscribe before posting.
Also, the following script "does the job" for Kagi emails (they spoof the "To" to be the customer), though I'd like to get the reply version working for other services:
tell application "Mail"
set incomingMessages to selected messages of message viewer 1
set incomingMessage to the first item of incomingMessages
set customerEmail to address of first item of recipients of incomingMessage -- ouch!
set regCode to do shell script "java -cp /path/to/codeGenerator " & customerEmail
set newMessage to make new outgoing message with properties {subject:"Registration code", content:"Hello," & return & ... & regCode & return & return & "Thanks for registering..."}
tell newMessage
set visible to true
set sender to "email@hidden"
make new to recipient at end of to recipients with properties {name:"", address:customerEmail}
end tell
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/mailman//archives/applescript-users
This email sent to email@hidden
Follow-Ups
:
Re: Mail.app "reply" verb returning nothing
From:
Michelle Steiner <email@hidden>
Prev by Date:
Re: AppleScript-Users Digest, Vol 4, Issue 2
Next by Date:
tell Finder window 1 if exists (was something else)
Previous by thread:
Re: AppleScript-Users Digest, Vol 4, Issue 2
Next by thread:
Re: Mail.app "reply" verb returning nothing
Index(es):
Date
Thread