set output to do shell script "defaults -currentHost read com.apple.screensaver askForPassword -int"
if output is "0" then
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 1"
tell application "GrowlHelperApp"
set the allNotificationsList to {"Screensaver Setting"}
set the enabledNotificationsList to {"Screensaver Setting"}
register as application "AppleScript - SSPass" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "System Preferences"
notify with name "Screensaver Setting" title "Screensaver Setting" description "The Screensaver password has been enabled." application name "AppleScript - SSPass"
end tell
else
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 0"
tell application "GrowlHelperApp"
set the allNotificationsList to {"Screensaver Setting"}
set the enabledNotificationsList to {"Screensaver Setting"}
register as application "AppleScript - SSPass" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "System Preferences"
notify with name "Screensaver Setting" title "Screensaver Setting" description "The Screensaver password has been disabled." application name "AppleScript - SSPass"
end tell
end if
beep[robg adds: Copy and paste the above into Script Editor and save it as an application. Double-click it and you should see Growl messages indicating the change in status (assuming you have Growl installed). Even slicker, use your favorite launcher app to assign a keyboard shortcut to run your script, and you'll have hotkey access to the toggle. This worked perfectly in my testing.]

