Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >UI printer selection problem (From: Oakley Masten <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.