Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kill screensaver and unlock a mac using appleScript

I'm trying to unlock my mac using my iPhone via bluetooth proximity, the code I'm using:

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

tell application "ScreenSaverEngine" to quit

It kills the screensaver, doesn't show the password box but all I get is a black screen. All applications still running but I'm hovering the mouse on this black screen. I'm running two monitors on a 10.6.7 build. What's wrong? Thanks.

lifehacker article http://lifehacker.com/5816791/use-a-bluetooth-phone-or-device-to-lock-and-unlock-your-mac-when-youre-near

like image 619
Antonio Max Avatar asked Jul 05 '11 03:07

Antonio Max


1 Answers

You could try an alternative way to kill the screen saver, such as a shell script with

#!/bin/sh
killall ScreenSaverEngine

And calling it directly, or writing an applescript to call it if you'd like that for some reason to do with the lifehacker article.

like image 173
shelhamer Avatar answered Sep 19 '22 06:09

shelhamer