Re: ScreenSaver settings
Re: ScreenSaver settings
- Subject: Re: ScreenSaver settings
- From: kai <email@hidden>
- Date: Mon, 9 Oct 2006 00:31:01 +0100
On 8 Oct 2006, at 16:30, Adam Bell wrote:
I use this to toggle my screen saver settings:
set prefPath to POSIX path of (path to home folder) & "/Library/
Preferences/ByHost/com.apple.screensaver."
set AppleScript's text item delimiters to ":"
set MACadd to text items of (primary Ethernet address of (system
info))
set AppleScript's text item delimiters to ""
if last word of (do shell script (("defaults read " & prefPath &
MACadd as string) & " | grep idleTime")) = "0" then
set idlT to "900" -- 15 minutes
else
set idlT to "0" -- never
end if
do shell script (("defaults write " & prefPath & MACadd as string)
& " idleTime " & idlT)
Nice one, Adam. You could probably condense that to something like
this (one line):
---------------
do shell script "defaults -currentHost write com.apple.screensaver
idleTime " & 900 * (1 div (1 + (do shell script "defaults -
currentHost read com.apple.screensaver idleTime")))
---------------
and this to discover what they are without toggling them.
set prefPath to POSIX path of (path to home folder) & "/Library/
Preferences/ByHost/com.apple.screensaver."
set AppleScript's text item delimiters to ":"
set MACadd to text items of (primary Ethernet address of (system
info))
set AppleScript's text item delimiters to ""
set SST to last word of (do shell script (("defaults read " &
prefPath & MACadd as string) & " | grep idleTime"))
Similarly:
---------------
do shell script "defaults -currentHost read com.apple.screensaver
idleTime"
---------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden