Handlers for enabling/Disabling Screen password in Mavericks

Hello.

I couldn’t find back to the originals, so here are handlers that works with Mavericks. I don’t test for UI Elements enabled anymore. You’ll have to assert that UI Elements are enabled yourself.

(*
http://macscripter.net/viewtopic.php?pid=171773#p171773
Copyright © 2014 McUsr All Rights reserved.

UI Elments must be enabled for the script to work
*)
script disablePasswordPrompt
	tell application "System Preferences"
		tell anchor "General" of pane "com.apple.preference.security" to reveal
		activate
	end tell
	tell application id "sevs"
		set screen_lock_on to value of checkbox 1 of tab group of window 1 of application process "System Preferences" as boolean
		if screen_lock_on then
			try
				tell checkbox 1 of tab group of window 1 of application process "System Preferences" to perform action "AXPress"
			end try
			delay 0.05
			try
				tell button 2 of sheet 1 of window 1 of application process "System Preferences" to perform action "AXPress"
			end try
		end if
	end tell
	tell application "System Preferences" to quit
end script
tell disablePasswordPrompt to run
(*
http://macscripter.net/viewtopic.php?pid=171773#p171773
Copyright © 2014 McUsr All Rights reserved.

UI Elments must be enabled for the script to work
*)
script EnablePasswordPrompt
	tell application "System Preferences"
		tell anchor "General" of pane "com.apple.preference.security" to reveal
		activate
	end tell
	tell application id "sevs"
		set screen_lock_on to value of checkbox 1 of tab group of window 1 of application process "System Preferences" as boolean
		if not screen_lock_on then
			try
				tell checkbox 1 of tab group of window 1 of application process "System Preferences" to click
			end try
		end if
	end tell
	tell application "System Preferences" to quit
end script
tell EnablePasswordPrompt to run