Background screensaver not working in Snow Leopard

Before Snow Leopard, I would run a background screen saver module using:

set screensaver_path to "/Volumes/Disk/Extra/Flowers.slideSaver"
set screensaver_name to "Flowers"

do shell script "/usr/bin/defaults -currentHost write  com.apple.screensaver  moduleName '" & screensaver_name & "' &&/usr/bin/defaults -currentHost write  com.apple.screensaver modulePath '" & screensaver_path & "'"

do shell script "/System/Library/Frameworks/Screensaver.framework/Resources/ScreensaverEngine.app/Contents/MacOS/ScreenSaverEngine -background > /dev/null 2>&1 &"

In Snow Leopard the command to choose the module seems to get ignored and, although the background screensaver runs ok, it is the screensaver set in the System Pref Panel and not the one I chose. Is it to do with a change in the way currentHost is addressed?

Any help would be greatly appreciated.:confused:

I’ll reply to myself here while waiting for an answer. I’m sure you’ve all played around with the background screensaver feature, but if not give it a try. It’s pretty cool. I might note that it’ll be even cooler once we can choose the screen module again.

P.S. I can’t help but think this has something to do with the writing to the currentHost command. I have two systems in front of me, leopard and snow leopard, and the leopard one works fine were as the snow leopard doesn’t seem to recognize the currentHost command. Any ideas? Please give it a try and let me know what you come up with.
(Note: the screensaver path is obviously arbitrary, as is the module that you choose to run.) :expressionless:

OK, I’m back with an update. After much trial and error I have narrowed the problem down to the ByHost pref file in the User’s Library folder. If I trash this file before choosing a new screensaver module, the new module becomes the default. So, my very ugly workaround has become:

  1. trash the pref file
  2. set new screensaver module

This is obviously less than satisfactory as a programing method (even though is does work) but will have to do until someone can explain a more elegant approach. Another question related to this concerns the name of the pref file that is created. As you all know the file name is a long string of numbers and letters (around 31 including hyphens). What do they stand for and do they change over time for a particular user? (I’m using that name in order to trash it and if it changes that will create obvious problems)

Please, please, any ideas or help/advice would be greatly appreciated.:rolleyes:

Sorry for this turning into somewhat of a personal blog as opposed to a proper forum session, but here we go again with an update.

Regarding my last question, after much searching around I found the following site that details “ByHost Preference Name Scheme Changes” in Leopard.

http://www.afp548.com/article.php?story=leopard_byhost_changes

Using that information I was able to discover that the long 32 number and letter combination in the pref file name I previously talked about is actually called the “UUID” and can be retrieved using:

do shell script "ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)'"

So, I came up with a very unprofessional way (there must be an easier way) of parsing the number out using:

set var1 to (do shell script "ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)'")
set UUID_Nmbr to (word 3 of var1) & "-" & (word 4 of var1) & "-" & (word 5 of var1) & "-" & (word 6 of var1) & "-" & (word 7 of var1)

So now I can use this number to designate the pref file I want to delete before setting the screensaver module again. Obviously, if I could get the settings to stick I wouldn’t have to keep deleting the file. Does anyone have an idea of how this might be accomplished? I must be missing a step somewhere.

Again, thank you for your patience and I look forward to hearing back from someone soon.:smiley:

Note: The reason I don’t just copy the file name is because I’m administering many machines and I’m trying to automate the process.