Re: How to know which items are selected in the Finder?
Re: How to know which items are selected in the Finder?
- Subject: Re: How to know which items are selected in the Finder?
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 29 May 2006 16:45:19 -0400
- Thread-topic: How to know which items are selected in the Finder?
on 2006-05-29 3:28 PM, David Niemeijer at email@hidden wrote:
>> If you register to observe the root application element, you receive
>> notifications for every UI element in the application. This is intended to
>> make it easy to monitor all of the application's UI elements at once,
>> without having to register to observe each element separately.
>
> Are you sure this really works for all notifications, those from
> menus, from text fields, etc. No hidden surprises as far as you know?
The Accessibility Reference for Assistive Applications release note promises
that this is true. I've never noticed a counterexample, but that doesn't
prove that my testing has exhausted all possibilities. In PreFab UI Actions,
I rely on this feature, and it hasn't let me down yet.
>> In general, the best (and only practical) way to explore and experiment with
>> notifications is to use PreFab UI Browser's Notifications drawer to register
>> notifications, then open its Notification Log window to watch the
>> notifications roll in in real time. ...
>
> I am using it all the time, but one of the things that bugs me is
> that some elements change briefly in response to a click or focus
> change and that seems hard to capture. For example, the menubar has
> an array of selected children that may contain the currently selected
> menubaritem, but I have find no way to actually get to see that in
> UIB (or the Accessibility Inspector) as I cannot freeze that state
> and navigate to it at the same time in UIB. Using the hotkey picks
> the item that is deepest down in the hierarchy so I need to navigate
> pack to the menubar and by that time of course nothing is selected
> anymore. But, maybe I am just doing something wrong.
There's a little-known Mac OS X technique that lets you navigate in UI
Browser without bringing it to the front, thereby keeping the target
application's menu open (or its palettes, or whatever else might disappear
as soon as some other application comes to the front). It's buried somewhere
in our documentation (and somewhere in the Mac OS X documentation), but it's
a gem when you need to do what you're trying to do:
(1) Turn OFF the UI Browser Hot Key preference to Activate UI Browser, so
that UI Browser will stay in the background when you use a hot key.
(2) Open whichever drawer in UI Browser you will want to examine, such as
the Attributes drawer.
(3) Click a menu bar item or menu item in the target application, then
quickly release the mouse button so that the menu remains open while you
move the mouse around on the screen.
(4) With the mouse over the open menu bar item or menu item, hit the
system-wide hot key (Control-Command-S by default). You will see UI
Browser's main browser view scroll to the menu bar item or menu item and
select it, but UI Browser will remain in the background because you turned
off its Activate UI Browser preference.
(5) Hold the Command key down while you click on various items in UI
Browser's main browser view. In Mac OS X, Command-clicking any background
application keeps it in the background but still operates its controls.
You will be able to navigate freely in UI Browser, seeing all the attributes
of each item you navigate to, and the menu in the target application will
remain open as long as you keep the Command key down while clicking around.
For example, you can back up to the menu itself by Command-clicking on it in
UI Browser's main browser view, scrolling by Command-clicking or
Command-dragging as needed. You can Command-click or Command-drag the scroll
bar in the drawer if the desired attribute is scrolled out of view, and the
target menu will still remain open.
The menu will close if you Command-click on certain items in UI Browser
(such as the Drawer button, which is why I told you to open the desired
drawer first -- the Drawer button opens a pop-up menu, and I Mac OS X
apparently allows only one menu to be open at a time). Even though the
target menu closes, the browser view will still show all the menu items and
allow you to navigate the part of the hierarchy that has already been
visited and is therefore still held in memory.
Unfortunately, there are some limitations to this technique, and I haven't
yet figured out how to work around them. For example, you can't select an
attribute in the table in the Attributes drawer by clicking on it while the
Command key is down, so you can't select a specific attribute while keeping
UI Browser in the background. Although you can click on an attribute without
the Command key, the menu will close. Because of this, if you select the
Selected Children attribute by clicking on it without the Command key, then
click the View in Window button to see the individual array items, the
window will be empty because the array items are no longer available to the
accessibility API. What I need is a way to select a table row in the drawer
by Command-clicking on it -- I'll look into it. Hopefully, I'm just
filtering out the Command key, which should be easy to fix.
Although you can't currently see the contents of the Selected Children
array, you can see which menu bar item or menu item has a Selected attribute
that is true, as long as you don't click the Refresh All button in the
drawer.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden