以编程方式解锁MAC

时间:2015-04-04 06:36:40

标签: 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"

1 个答案:

答案 0 :(得分:0)

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