• 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
Scripting Mail message redirection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting Mail message redirection


  • Subject: Scripting Mail message redirection
  • From: Jim <email@hidden>
  • Date: Mon, 27 Mar 2006 20:26:22 -0800

It seems the topic of scripting mail message redirects has been brought up before.
It seems that there are folks who had working scripts to do this with Mail on Panther, but the scripts died with upgrading to Tiger.
It also seems that nobody has really come up with a solution.
Is that still the case?


I've run into this same issue today, trying to create a script which would redirect selected messages to another address.
I've got working scripts that will create a new message with the raw source or the content of an existing message, but it's just not quite the same.


My setup

- Mac OS X (10.4.5)
- Mail (2.0.7)

When watching what happens in Script Debugger's debug mode, we can see the newMailMessage get set, and then disappear as soon as we attempt to create new new message object.

Since the new message object dies off, we really can't do anything with the message we thought we were going to redirect, because Applescript keeps reporting that newMailMessage is not defined.

Following is a quick snippet of the sample code to reproduce this behaviour. If anyone has any brilliant ideas on how to work around this and get a script working that will redirect selected messages, I'd love to hear those ideas, and/or solutions :-)

- JIM -


-- sample code --

tell application "Mail"
activate
set selectedMessages to the selection
set newMailMessage to "uselessvalue"
-- at this point the newMailMessage var is set with the useless value
repeat with thisMessage in selectedMessages
set newMailMessage to redirect thisMessage -- with opening window
-- immediately after redirect returns, the newMailMessage var no longer exists
-- and the following test always answers as undefined because the newMailMessage var no longer exists
if newMailMessage then
display dialog "newMailMessage is defined"
else
display dialog "newMailMessage is not defined"
end if
end repeat
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:
This email sent to email@hidden


  • Prev by Date: Re: a script for saving text from the clipboard to a file
  • Next by Date: Re: How far back?
  • Previous by thread: Re: vcal and ics files in OS9
  • Next by thread: Missing class?
  • Index(es):
    • Date
    • Thread