objective-c - 以编程方式解锁 MAC

标签 objective-c macos applescript

我想以编程方式解锁 mac。目前我正在为这个提议使用 Apple 脚本。它工作正常,但问题是这是一个耗时的过程。执行脚本大约需要 4-5 秒。这是我使用 NSAppleScript 执行的脚本。请建议我如何让它快速工作。或任何其他最快的方式。谢谢

tell me to activate\n
tell application \"System Events\" to keystroke \"PASSWORD\"\n 
tell application \"System Events\" to keystroke return\n 
tell application \"System Events\" to keystroke return"

最佳答案

tell application "System Events"
    tell security preferences
       set require password to wake to false
    end tell
 end tell

tell application "System Events"
    stop current screen saver
end tell

tell application "System Events"
    tell security preferences
        set require password to wake to true
    end tell
end tell

关于objective-c - 以编程方式解锁 MAC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29443520/

相关文章:

objective-c - cllocationmanager 不请求用户权限 ios8

ios - IBDesignable 不显示编程 UI 元素

objective-c - AVPlayer 播放声音,但在 Mac 应用程序中不显示 View

java - JFrame 未在 Mac 上运行

macos - Applescript,我试图让一个列表出现在一个对话框中,其中只有我拥有的总数的 3

ios - 从另一个 View Controller 更新 UILabel

macos - OS/X 64 位汇编代码生成总线错误

macos - 在 Mac OS X 中卸载软件包

javascript - 苹果脚本 : Javascript to click in safari with unknown id

objective-c - 使用 Applescript 创建一个简单的菜单栏应用程序