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

GUI Scripting in Mail


  • Subject: GUI Scripting in Mail
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 16 Jan 2013 11:53:44 -0600

Here is a snippet from a script that has worked in Leopard,
Snow Leopard and Lion, but fails in Mt Lion …

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 2 -- wait for the Save window
set value of text field 1 of window 1 to "tempFile.pdf" --***** ERROR HERE IN MT LION ********
---------------------------------
keystroke return -- click button "Save" of sheet 1 of window 1
end tell
end tell

The Save windows that appear seem to be the same in Lion and Mt Lion,
but in Mt Lion I get the error message:

Error = -1719
System Events got an error: Can't get text field 1
of window 1 of process "Mail". Invalid index.

Does anyone see the problem here?

I've tried using Accessibility Inspector, but I see nothing helpful.



 _______________________________________________
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: GUI Scripting in Mail
      • From: Luther Fuller <email@hidden>
    • Re: GUI Scripting in Mail
      • From: Luther Fuller <email@hidden>
    • Re: GUI Scripting in Mail
      • From: "William J. Cheeseman" <email@hidden>
    • Re: GUI Scripting in Mail
      • From: "William J. Cheeseman" <email@hidden>
  • Prev by Date: Re: turning on print options when printing a file
  • Next by Date: Re: turning on print options when printing a file
  • Previous by thread: Re: turning on print options when printing a file
  • Next by thread: Re: GUI Scripting in Mail
  • Index(es):
    • Date
    • Thread