Re: default write ... for turning on GUI scripting?
Re: default write ... for turning on GUI scripting?
- Subject: Re: default write ... for turning on GUI scripting?
- From: Bill Cheeseman <email@hidden>
- Date: Sun, 02 Dec 2007 21:34:01 -0500
- Thread-topic: default write ... for turning on GUI scripting?
on 2007-12-02 8:31 PM, John Joyce at email@hidden
wrote:
> Anyone know offhand the keys for command line tool 'default' to turn
> on (and subsequently off) GUI scripting?
Do you mean to turn on and off the "Enable access for assistive devices"
setting in the Universal Access pane of System Preferences? Or the Enable
GUI Scripting setting in AppleScript Utility? Both of them control the same
system switch.
I'm not aware that there is a defaults key for it.
There are two ways you can turn it on and off programmatically. One is to
send an Apple event to set the 'UI elements enabled' property of the
'application' object in the System Events Suite of the System Events
application to true. The other is to send an Apple event to set the 'GUI
Scripting enabled' property of the AppleScript Utility application to true.
Both techniques require the user to authenticate. The first works in Tiger
and Leopard; the second is new in Leopard.
Depending on what you're trying to accomplish, there is a third technique
that might be useful. Use the AXMakeProcessTrusted() function in the
accessibility API, declared in AXUIElement.h in the HIServices subframework
of the ApplicationServices framework. This will make your application
trusted so that it can use the accessibility API without turning on the
global accessibility switch at all. This won't enable GUI Scripting
generally, but it will enable your application to send GUI Scripting-style
commands to control another application by using the same accessibillty
functions that GUI Scripting uses. This requires authentication, as well. It
was said not to work in Tiger, but I suspect that it actually did work if
you knew what to do. It does work in Leopard.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com
PreFab Software - www.prefabsoftware.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden