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: Bill Cheeseman <email@hidden>
- Date: Fri, 26 Sep 2008 07:06:26 -0400
- Thread-topic: triggering an NSMenuItem to speak as needed
on 2008-09-25 11:21 PM, Martin Wierschin at email@hidden wrote:
> Sorry to reply to myself here, but I have another related question.
>
>> I'm trying to programmatically activate an NSMenuItem so that both
>> its action and any feedback cues (eg: VoiceOver) are triggered.
>
> I've tried everything I can think of and nothing works. I'm basically
> resigned to speaking the text manually. The obstacle now is figuring
> out if the user has VoiceOver enabled or not. I can't find any public
> APIs for this either, am I stuck loading up
> "com.apple.universalaccess" myself? Hardly ideal, but I don't see
> other options.
I don't have direct answers for you, but only suggestions. I don't recall
the details of your first posting, but as I recall you are writing your own
application to do all this.
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.
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.
--
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.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden