• 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: who owns the dialog box from a print command?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: who owns the dialog box from a print command?


  • Subject: Re: who owns the dialog box from a print command?
  • From: Luther Fuller <email@hidden>
  • Date: Sat, 17 Aug 2013 14:50:57 -0500

Here's a handler I use that solved a similar problem for me.
Direct your attention to the line   if OSMtLion then   ...

on GUIprintToPDF(tempFileName, OSMtLion)
tell application "System Events"
tell process "Mail"
set frontmost to true
-------------------------
keystroke "p" using {command down} -- opens Print dialog
repeat 20 times -- wait for print sheet to appear
delay 1
set frontmost to true
if exists sheet 1 of window 1 then exit repeat
end repeat
if not (exists sheet 1 of window 1) then error "Mail is not responding. The Print dialog failed to appear."
set frontmost to true
-------------------------
set PDFButton to (first menu button of sheet 1 of window 1)
click PDFButton
click menu item 2 of menu 1 of PDFButton -- Save as PDF...
delay 1 -- wait for the Print window
-------------------------
if OSMtLion then
try
set value of text field 1 of sheet 1 of sheet 1 of window 1 to tempFileName --** for Mt Lion only
on error
error "The pdf document was not created. (in GUIprintToPDF)" 
end try
else
set value of text field 1 of window 1 to tempFileName --** for Lion and previous
end if
-------------------------
set frontmost to true
keystroke "d" using {command down} -- sets save location to Desktop
keystroke return -- click button "Save"
repeat
delay 1
if not (exists sheet 1 of window 1) then exit repeat
end repeat
end tell
end tell
end GUIprintToPDF ------------------------------------------



 _______________________________________________
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: 
 >who owns the dialog box from a print command? (From: Jim Brandt <email@hidden>)

  • Prev by Date: Re: who owns the dialog box from a print command?
  • Next by Date: AsciiReplacement
  • Previous by thread: Re: who owns the dialog box from a print command?
  • Next by thread: Re: who owns the dialog box from a print command?
  • Index(es):
    • Date
    • Thread