• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ScreenSaver settings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >ScreenSaver settings (From: Adam Bell <email@hidden>)

  • Prev by Date: Re: Backlight using GUI scripting doesn't work...
  • Next by Date: Re: Backlight using GUI scripting doesn't work...
  • Previous by thread: ScreenSaver settings
  • Next by thread: Re: 10.4 Print Options (Save as PDF)
  • Index(es):
    • Date
    • Thread