Re: triggering an NSMenuItem to speak as needed
Re: triggering an NSMenuItem to speak as needed
- Subject: Re: triggering an NSMenuItem to speak as needed
- From: Martin Wierschin <email@hidden>
- Date: Tue, 30 Sep 2008 20:46:33 -0700
Hi Bill,
Thanks for your thoughts and suggestions.
1. In Leopard, you can turn on the "Enable access for assistive
devices"
setting in the Universal Access pane of System Preferences
programmatically.
Doing this programmatically is said not to work in Tiger due to a
bug, but I
never tried it in Tiger and suspect that it might actually be
possible. To
turn it on programmatically, you have to go through a fairly
convoluted
technique: embed a helper application in your main application
bundle, set
it up to run as root with authentication, and call the
AXMakeProcessTrusted
function.
2. I don't know for sure, but I'm guessing that you cannot access the
VoiceOver switch programmatically. However, you could probably do
it using
AppleScript's GUI Scripting functionality, by sending Apple events
to the
System Events application to tell it to open the Universal Access
pane of
System Preferences, choose the Seeing tab, and click the VoiceOver
On radio
button. There might be an easier way.
To me this seems more fragile, both in terms of implementation
complexity and chance for future incompatibilities, than reading an
undocumented key in the accessibility plist. Apple is always free to
rearrange GUI elements in the preferences so the AX probe fails,
correct?
3. I was under the impression that VoiceOver would speak menu item
names
automatically when their menu is opened and then the mouse is
placed over
the menu item. You can do at least part of that with GUI Scripting
again.
Using AppleScript, you would first perform a 'click' action on the
menu
itself to open it, then I guess you would have to find a command to
move the
mouse into the desired menu item's rect. Off the top of my head, I
don't
know that you can do that with GUI Scripting, but you should be
able to do
it using a variety of code techniques, such as Quartz Event Taps.
Using AppleScript seems like a good technique. It unfortunately seems
to require that the "enable access for assistive devices" option be
enabled, which is a shame. I could enable it as you've outlined
above, but honestly I don't feel like modifying a system preference
is a valid way to work around such a local problem and could upset
users.
So far I think speaking the menu item text manually may be the least
makeshift.
Thanks again for your help,
~Martin
_______________________________________________
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