• 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: UI printer selection problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UI printer selection problem


  • Subject: Re: UI printer selection problem
  • From: Bill Cheeseman <email@hidden>
  • Date: Mon, 27 Aug 2007 17:58:36 -0400
  • Thread-topic: UI printer selection problem

on 2007-08-27 3:18 PM, Oakley Masten at email@hidden wrote:

> activate application "Microsoft Excel"
> tell application "Microsoft Excel"
> tell application "System Events"
> tell process "Excel"
>
> delay 1
> get value of pop up button 3 of window "Print"
> set whatme to value of pop up button 3 of window
> "Print"
>
> --whatme shows a value of "Toshiba_Print"  --Which
> is correct
>
> set value of pop up button 3 of window "Print" to
> "HP5100  Creative"
> --this does not work  --How do I get it to work?
>
> end tell
> end tell
> end tell
>
> I can't figure out how to choose an item from a drop
> down list would appear to be the issue.

The correct way to choose pop-up menu items is to click the menu button
first to open it, then click the desired menu item. The reason for this is
that Mac OS X doesn't know what menu items are in a menu until you open it
by clicking it.

You also have to be aware that pop-up buttons have a hidden 'menu' object,
which is a child of the pop-up button object, and which in turn has 'menu
item' objects as its children. You can't see this hidden 'menu' object
unless you look for it while the menu is open, because it doesn't exist
until the menu is open. That's why you can't see it as a child of the pop-up
button when UI Browser is in browser mode. To see it, switch to UI Browser's
Screen Reader window, open the Excel Printer pop-up button manually with
your mouse, and you'll see the menu and menu item under the mouse in the
Screen Reader window.

Putting it all together, this script will work:

activate application "Microsoft Excel"
tell application "System Events"
    tell process "Excel"
        tell pop up button 3 of window "Print"
            click
            click menu item "HP5100 Creative" of menu 1
        end tell
    end tell
end tell

Notice that you had one too many 'tell' blocks in your script. You shouldn't
use an outer 'tell' block addressed to the target application. What you want
to do with GUI Scripting is to 'tell' the System Events application to
'tell' the target application's 'process' object to do something.

I'm sorry I couldn't get this to work for you in our private correspondence
earlier. I don't know what I was thinking.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.com


 _______________________________________________
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: 
 >UI printer selection problem (From: Oakley Masten <email@hidden>)

  • Prev by Date: Re: Shell script fails to return desired results
  • Next by Date: InDesign CS2, Polygons, and madness
  • Previous by thread: UI printer selection problem
  • Next by thread: InDesign CS2, Polygons, and madness
  • Index(es):
    • Date
    • Thread