Detect the presence of your Bluetooth device and execute actions on your Mac.

BlueSense analyzes the signal of your Bluetooth device and executes any desired actions when you move or come back at proximity of your Mac.

BlueSense requires OS X 10.10 or later
BlueSense AppleScripts

How to enable the screensaver password on Mac OS X in AppleScript

Launch the screensaver and enable the password to protect your Mac.


script EnableScreenSaverPassword
	try
		-- method 1
		tell application "System Events"
			tell security preferences
				activate
				set properties to {require password to wake:true}
			end tell
			tell application id "com.apple.ScreenSaver.Engine" to launch
		end tell
		-- method 2 (change user defaults but do not prompt for the password)
		(*
		do shell script ("/usr/bin/defaults write com.apple.screensaver askForPassword -int 1")
		do shell script ("/usr/bin/defaults write com.apple.screensaver askForPasswordDelay -int 5")
		-- Launch the  ScreenSaver
		tell application id "com.apple.ScreenSaver.Engine" to launch
		*)
	on error errString number errorNumber
		log (errString)
	end try
end script