default write ... for turning on GUI scripting?

  • Anyone know offhand the keys for command line tool 'default' to turn
    on (and subsequently off) GUI scripting?
  • on 2007-12-02 8:31 PM, John Joyce at <dangerwillrobinsondanger...>
    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 - <bill...>
    Quechee Software, Quechee, Vermont, USA
    www.quecheesoftware.com

    PreFab Software - www.prefabsoftware.com
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today