Hey Guys,
I am attempting to create a script that will either turn on or off auto log-off under the security preference pane as well as doing it without a password prompt.
When run it will give me a dialog box with three choices. Yes, No, Cancle.
For some reason when I run it, everything seems to compile fine and I get an echo message in the console that seems to show everything doing what it should. When I double check that the auto log-off option has been affected, it never changes...
Appreciate any help/advice on this!
I am attempting to create a script that will either turn on or off auto log-off under the security preference pane as well as doing it without a password prompt.
When run it will give me a dialog box with three choices. Yes, No, Cancle.
For some reason when I run it, everything seems to compile fine and I get an echo message in the console that seems to show everything doing what it should. When I double check that the auto log-off option has been affected, it never changes...
Code:
display dialog "Auto Logoff Script" buttons {"Yes", "No", "Cancel"} default button 3
set the button_pressed to the button returned of the result
if the button_pressed is "Yes" then
tell application "System Events"
tell security preferences
get properties
--> returns: {require password to wake:false, class:security preferences object, secure virtual memory:false, require password to unlock:false, automatic login:false, log out when inactive:false, log out when inactive interval:60}
set properties to {log out when inactive:true}
end tell
end tell
else if the button_pressed is "No" then
tell application "System Events"
tell security preferences
get properties
--> returns: {require password to wake:false, class:security preferences object, secure virtual memory:false, require password to unlock:false, automatic login:false, log out when inactive:false, log out when inactive interval:60}
set properties to {log out when inactive:false}
end tell
end tell
else
display dialog "Canceld"
end if
Appreciate any help/advice on this!