0
votes

IS it possible to enable MAC OS X assistive technologies programmatically on Snow Leopard, Lion and Mountain Lion?

I've got a client with an application that needs the "Enable access for assistive device" checkbox checked in Universal Access. This is for an application that is expected to run on Snow Leopard, Lion and Mountain Lion.

Can it be done via an Applescript or a shell script embedded in an Objective C application or MUST it be enabled manually, explicitly by the user?

2

2 Answers

1
votes

Here's what I use...

enable_GUI_scripting()

on enable_GUI_scripting()
    try
        if (system attribute "sysv") < 4138 then display dialog "This script requires the installation of Mac OS X 10.3 or higher." buttons {"Cancel"} default button 1 with icon 2
        tell application "System Events" to if not UI elements enabled then
            tell me
                activate
                display dialog "This script requires the built-in Graphic User Interface Scripting architecture of Mac OS X, which is currently disabled." & return & return & "Enable GUI Scripting now? (You may be asked to enter your password.)" buttons {"Cancel", "Enable"} default button 2 with icon 2
            end tell
            set UI elements enabled to true
            if not UI elements enabled then error number -128
        end if
        return "yes"
    on error
        return "no"
    end try
end enable_GUI_scripting
0
votes

Try this :

tell application "System Events"
activate
set UI elements enabled to true
end tell