Re: Toggle Screensaver
Re: Toggle Screensaver
- Subject: Re: Toggle Screensaver
- From: John Baltutis <email@hidden>
- Date: Fri, 17 Feb 2006 21:37:18 -0800
On 02/17/06, kai <email@hidden> wrote:
> On 17 Feb 2006, at 20:45, John Baltutis wrote:
>
>> Since the setting is stored in one of many ~/Library/Preferences/
>> ByHost/
>> com.apple.screensaver.XXXX.plist files (there are four in my
>> directory), you'll
>> have to find the one that includes the key IdleTime (in seconds).
>> However,
>> although you can read it with the terminal command "defaults read
>> ~/Library/Preferences/ByHost/ in the com.apple.screensaver.XXXX",
>> AFAICT,
>> there's no way to write to it; all attempts result in a "Rep
>> argument is not a
>> dictionary Defaults have not been changed." message. Good luck in your
>> endeavors. Plist manipulations are esoteric. See the manpage for
>> defaults.
>
> I was quite content with my solitary little file before I read that,
> John. Now I feel kinda short-changed... ;-)
>
> In that case, I suppose a variation of my last suggestion might go
> something like:
>
> -----
> set f to (path to preferences folder as Unicode text) & "ByHost"
> tell application "Finder" to set l to (folder f's files whose name
> starts with ¨
> "com.apple.screensaver" and name does not contain "slideshow")
> repeat with i in l
> set p to (i as Unicode text)'s POSIX path
> tell application "System Events" to tell property list item ¨
> "idleTime" of property list file p to if exists then
> if value is 0 then
> set value to 180
> else
> set value to 0
> end if
> exit repeat
> end if
> end repeat
>
Interestingly enough, there are four com.apple.screensaver.XXX plist files in
~/Library/Preferences/ByHost:
One containing:
moduleName = Cosmos;
modulePath = "/System/Library/Screen Savers/Cosmos.slideSaver";
one with:
idleTime = 900;
lastPictureDirectoryChosen = "/Users/baltwo/Library/Screen Savers";
moduleName = Cosmos;
modulePath = "/System/Library/Screen Savers/Cosmos.slideSaver";
one with:
{Center = 0; Crop = 1; Crossfade = 1; Random = 0; Zoom = 1; }
and one com.apple.screensaver.slideshow with:
{SlideFolder = "/Users/baltwo/Library/Screen Savers"; }
I suspect you'd have to read each of the first three and then apply your change
to the one containing the IdleTime key. BTW, I didn't try your script. Does it
in fact change the idle time? I tried with the defaults command and with the
Property List Editor. Neither would change the value. Only using the slider in
the screensaver PrefPane was effective.
I also suspect that the second one can be deleted without any effect, but I'm
not doing it.
_______________________________________________
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