• 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: Selecting a pop up button value in a Print dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting a pop up button value in a Print dialog


  • Subject: Re: Selecting a pop up button value in a Print dialog
  • From: Axel Luttgens <email@hidden>
  • Date: Wed, 10 Mar 2010 16:24:59 +0100

Le 10 mars 2010 à 15:03:30, Jim Brandt a écrit :

> Is there a way to select an item of a pop up button in a print dialog sheet?
>
> I have a script that logs on to a web page and "prints" that page to a PDF file using the print dialog to save as PDF. One of my printer presets is a Grayscale option, and Preview saves the file without color. I'm able to detect that this option is set, via the following code, when the "Print" sheet is open:
>
> tell application "System Events"
>  tell process "Safari"
>    set nm to name of front window
>    set x to value of pop up button 2 of sheet "Print" of window nm
>
>    ...
>
> However this code does NOT work:
>
>    if x contains "Grayscale" then
>      set value of pop up button 2 of sheet "Print" of window nm to "Front tray-2 Side Color Economy 1"
>    end if
>
> So my questions:
>
> 1) Is there a way to select one of the other options of this pop up button?
>
> 2) Since these options vary from printer to printer based on saved options established by the user of the printer, is there a way to obtain all the possible available values?

Hello Jim,

This is what I get here, after some trials and errors, with Safari 4.0.4 on Mac OS X 10.6.2:

tell application "System Events"
	tell application process "Safari"
		tell front window
			tell sheet 1
				tell pop up button 3
					-- Display the local menu
					perform action "AXPress"
					tell menu 1
						-- Q2: get available "values"
						name of menu items
						-- Q1: select an option
						tell menu item 1
							perform action "AXPress"
						end
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

In the hope above skeleton may be of some help,
Axel

 _______________________________________________
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: 
 >Selecting a pop up button value in a Print dialog (From: Jim Brandt <email@hidden>)

  • Prev by Date: Re: Selecting a pop up button value in a Print dialog
  • Next by Date: Re: multi input form
  • Previous by thread: Re: Selecting a pop up button value in a Print dialog
  • Next by thread: Re: Selecting a pop up button value in a Print dialog
  • Index(es):
    • Date
    • Thread