0

Snow Leopard、Lion、Mountain Lion で MAC OS X 支援技術をプログラムで有効にすることはできますか?

ユニバーサル アクセスで [補助デバイスへのアクセスを有効にする] チェックボックスをオンにする必要があるアプリケーションを持つクライアントを持っています。これは、Snow Leopard、Lion、および Mountain Lion での実行が予想されるアプリケーション用です。

ApplescriptまたはObjective Cアプリケーションに埋め込まれたシェルスクリプトを介して実行できますか、それともユーザーが明示的に手動で有効にする必要がありますか?

4

2 に答える 2

1

これが私が使用するものです...

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
于 2012-03-20T16:22:37.303 に答える
0

これを試して :

tell application "System Events"
activate
set UI elements enabled to true
end tell
于 2012-03-20T15:36:49.750 に答える