• 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
Printing from mail.app with UI scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing from mail.app with UI scripting


  • Subject: Printing from mail.app with UI scripting
  • From: Jacco Rens <email@hidden>
  • Date: Thu, 5 Aug 2010 09:06:26 +0200

Hello All,

I have the need for printing certain messages via a rule from within Mail.app.

Those messages are html formed, and need to be printed as seen (command + P). I tried writing a script that does this, but it fails because when run automatically, it has no message selected to invoke the command + p action. What I'm looking for, as an addition to this script, that opens the message in a new window, and then prints it. If we could add an file message action to it, that would be awesome.

Google gave me so far only plaintext printing solutions.

Script so far:

on perform_mail_action(theData)
	tell application "Mail"
		set theSelectedMessages to |SelectedMessages| of theData
		set theRule to |Rule| of theData
		repeat with a from 1 to count theSelectedMessages
			tell application "Mail" to activate
			-- open the item a of theSelectedMessages, need help here
			tell application "System Events"
				tell process "mail"
					keystroke "p" using command down
					keystroke return
				end tell
			end tell
			-- file item a of theSelectedMessages to sub folder called "orders"
		end repeat
	end tell
end perform_mail_action

Thanks for your insights!!

--
jacco _______________________________________________
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

  • Follow-Ups:
    • Re: Printing from mail.app with UI scripting
      • From: Philip Aker <email@hidden>
  • Prev by Date: Re: Show differences in two apple scripts.
  • Next by Date: Re: Show differences in two apple scripts.
  • Previous by thread: make apple mail to use a particular mail address in special case
  • Next by thread: Re: Printing from mail.app with UI scripting
  • Index(es):
    • Date
    • Thread