There's an option in the preference panel to change the time the mac is able to be in sleep/screensaver before requiring a password to be unlocked again.
I'm using OS X Lion 10.7.
Is there any way to change this setting using the terminal or an applescript?
I tried to change the plist file using:
defaults write com.apple.screensaver askForPasswordDelay -int 60
also tried
defaults write com.apple.screensaver askForPasswordDelay -float 60
also completely disabling the password didnt work either
defaults write com.apple.screensaver askForPassword -int 0
The plist file was changed, but it had no effects at all.
It's the same plist file that gets changed when manually switching the setting in the preferences.
Would be awesome if anyone got an idea how to fix my problem.
EDIT:
also tried to: 1) add -currentHost flag 2) drop the -int / -float
Best Answer
You can do this using UI scripting. This requires enabled support for assistive devices in Universal Access preference pane. You can launch the script from the command line using
osascript
, but you need to have a GUI session for this to work.Based on my older answer here, I created the following script which works on my File Vault enabled Lion. Apparently, a checkbox to disable the password altogether was removed, either by Lion itself or me enabling File Vault 2. In the latter case I cannot fix the script for you, but the linked one might work.
Change the index (
6
) of the menu item to click in the 9th line to select which of the options to choose.The following is the "official" method of changing this setting in AppleScript:
It has two major problems: