• 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
Re: Accessing front window of Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing front window of Mail.app


  • Subject: Re: Accessing front window of Mail.app
  • From: Christopher Stone <email@hidden>
  • Date: Sun, 6 Sep 2009 19:47:58 -0500

On Sep 06, 2009, at 12:17, Mike Matthews wrote:
I'd like the script to operate on an open outgoing message window that is front-most.
______________________________________________________________________

Hey Mike,

Unfortunately scripting support for outgoing messages in Mail is completely abysmal (shocking and infuriating considering how mature a product it is).

This is pretty reliable BUT you must SAVE the outgoing message for it to work, and you can run into trouble if you have more than one draft message with the same subject.

tell application "Mail"
set winName to name of front window
set msg to last message of drafts mailbox whose subject is winName

tell msg
set mRecip to {name, address} of every recipient
set mContent to content
set mSubject to subject
set mSender to sender
set mDate to date sent
-- properties
end tell
end tell

--
Chris

 _______________________________________________
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

References: 
 >Accessing front window of Mail.app (From: Mike Matthews <email@hidden>)
 >Re: Accessing front window of Mail.app (From: Mike Matthews <email@hidden>)

  • Prev by Date: Re: new (I think) time question
  • Next by Date: Re: date/Snow Leopard changed
  • Previous by thread: Re: Accessing front window of Mail.app
  • Next by thread: Paste Text Into Mail
  • Index(es):
    • Date
    • Thread