首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >以编程方式启用MAC OSX辅助技术?

以编程方式启用MAC OSX辅助技术?
EN

Stack Overflow用户
提问于 2012-03-20 23:21:39
回答 2查看 1K关注 0票数 0

是否有可能在雪豹、狮子和山狮上以编程方式启用MAC OS X辅助技术?

我有一个客户端,它的一个应用程序需要在通用访问中选中“启用辅助设备的访问”复选框。这是一个可以在雪豹、狮子和山狮上运行的应用程序。

它可以通过嵌入到Objective C应用程序中的Applescript或shell脚本来完成吗?还是必须由用户明确地手动启用?

EN

回答 2

Stack Overflow用户

发布于 2012-03-21 00:22:37

这是我使用的.

代码语言:javascript
复制
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
票数 1
EN

Stack Overflow用户

发布于 2012-03-20 23:36:50

试试这个:

代码语言:javascript
复制
tell application "System Events"
activate
set UI elements enabled to true
end tell
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9789622

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档