Hi Mitchell,
It's
REALLY late right now, but here's a quick script that I just whipped up that should do the trick:
property SSITTimes : {0, 3, 5, 15, 30, 60, 120}
property SSTTimes : {0, 1, 15, 30, 60, 120, 180}
property DSTTimes : SSTTimes
property LOTTimes : {0, 15, 30, 60, 120, 180, 240, 300, 360, ¬
420, 480, 540, 600, 660, 720, 780, 840, 900, 960}
-------------------------------
--get current screen saver idle time (in seconds)
try
set ether to do shell script ¬
"/sbin/ifconfig en0 | grep ether | cut -d' ' -f 2 | sed 's/://g'"
set SSIT to (do shell script ¬
"defaults read ByHost/com.apple.screensaver." & ¬
ether & " idleTime") as number
on error
set SSIT to 0
end try
set SSITDefault to SSIT div 60
if SSIT is 0 then
set SSITText to "Never"
else
set SSITText to SSITDefault & " minutes" as string
end if
--get current disk sleep time (in minutes)
try
set SST to (do shell script ¬
"pmset -g | grep ' sleep' | awk '{print $2}'") ¬
as number
on error
set SST to 0
end try
if SST is 0 then
set SSTText to "Never"
else
set SSTText to SST & " minutes" as string
end if
--get current display sleep time (in minutes)
try
set DST to (do shell script ¬
"pmset -g | grep displaysleep | awk '{print $2}'") ¬
as number
on error
set DST to 0
end try
if DST is 0 then
set DSTText to "Never"
else
set DSTText to DST & " minutes" as string
end if
--get current auto log out delay (in seconds)
try
set LOT to (do shell script ¬
"defaults read /Library/Preferences/.GlobalPreferences " & ¬
"com.apple.autologout.AutoLogOutDelay") as number
on error
set LOT to 0
end try
set LOTDefault to LOT div 60
if LOT is 0 then
set LOTText to "Never"
else
set LOTText to LOTDefault & " minutes" as string
end if
-------------------------------
set newSSIT to ¬
(choose from list {SSITDefault} & SSITTimes with prompt ¬
"Screen Saver (" & SSITText & "):" & return & ¬
"(0 is Never)" default items SSITDefault) as string
if newSSIT is "false" then return
set newSST to ¬
(choose from list {SST} & SSTTimes with prompt ¬
"System Sleep (" & SSTText & "):" & return & ¬
"(0 is Never)" default items SST) as string
if newSST is "false" then return
set newDST to ¬
(choose from list {DST} & DSTTimes with prompt ¬
"Display Sleep (" & DSTText & "):" & return & ¬
"(0 is Never)" default items DST) as string
if newDST is "false" then return
set newLOT to ¬
(choose from list {LOTDefault} & LOTTimes with prompt ¬
"Log Out Time (" & LOTText & "):" & return & ¬
"(0 is Never)" default items LOTDefault) as string
if newLOT is "false" then return
--quit "System Preferences" (if running)
tell application "System Events"
if "System Preferences" is in name of processes then ¬
tell application "System Preferences" to quit
end tell
--set screen saver idle time (in seconds)
do shell script "defaults write ByHost/com.apple.screensaver." & ¬
ether & " idleTime -int " & newSSIT * 60
--set auto log out (in seconds)
do shell script "defaults write /Library/Preferences/.GlobalPreferences " & ¬
"com.apple.autologout.AutoLogOutDelay -int " & newLOT * 60
--set display sleep time (in minutes)
--set (system) sleep time (in minutes)
do shell script "pmset displaysleep " & newDST & ¬
" ; pmset sleep " & newSST with administrator privileges
I'm sure it can be cleaned up quite a bit (like I said it's
REALLY late and I'm
VERY tired). If you have any questions about the script feel free to ask and I'll try to do my best to answer them
😉
Hope this
at least guides you in the right direction. I know it's not done exactly the way you were asking for, but what you're asking for is really best suited for an AppleScript Studio project. Vanilla AppleScript is pretty limited on user interaction.