Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Change desktop pictures on networked home folder Desktop
One of the advantages of OSX is the ability to keep your home folder on a network server, so that when you log on from any OSX mac on the network, all your preferences, Finder windows, and settings are as you left them. The same applied to the desktop picture in 10.0, but this changed in 10.1 so that using the system preference to change the desktop background only changes it for that machine.

The combination of an AppleScript and a shell script restores the ability to change the background on all machines at once. Read the rest of the article for the scripts and the instructions.

Create a new Applescript with the following contents:
-- Choose file or files to process
on run {}
set theFile to (choose file with prompt "Choose a .jpg file") as string
changepic(theFile)
end run

-- This code runs for files dropped onto icon
on open (fileList)
set theFile to the first item of fileList as string
changepic(theFile)
end open

-- Routine to change preferences file com.apple.desktop.plist
on changepic(theFile)
-- Make the path to the file POSIX compliant
set theFile to POSIX path of theFile
-- call shell script (the script can be anywhere; change ~/UnixWork/Deskpic accordingly)
set theScript to "cd ~/UnixWork/Deskpic; ./changepic " & """ & (theFile as string) & """
do shell script theScript
end changepic
Save the AppleScript as an executable somewhere easy to use (on the Desktop, for example). Then create a shell script (named 'changepic' in this example) with the following contents:
#!/bin/tcsh
# This shell script takes a full pathname of a picture file, and replaces the previous
# reference in the desktop preferences. It assumes all picture files are .jpg

if ($# > 0) then
# remove leading /private/automount (My home folders are stored on an NFS network server
# and OSX has a habit of putting this in front of the true path, which can cause problems)
set picpath=`echo $1 | sed 's/^\/private\/automount//'`
# replace / with \/ to allow proper interpretation by sed later
set picpath=`echo $picpath | sed 's/\//\\\//g'`
# replace file names in com.apple.desktop.plist
cd ~/Library/Preferences
sed "s/<string>.*jpg/<string>$picpath/g" com.apple.desktop.plist > temp
# if sed successful, replace original file
if ( "$?" == 0 ) then
mv temp com.apple.desktop.plist
# restart the finder
kill -HUP `ps ax | grep -i "Finder.app" | grep -v grep | cut -c 1-6`
endif
endif
Save the script and make it executable, and then just launch the AppleScript to change all the desktop pictures at once.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[7,525 views]  

Change desktop pictures on networked home folder | 1 comments | Create New Account
Click here to return to the 'Change desktop pictures on networked home folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Home Folder on Network Volumes?
Authored by: uurf on Apr 23, '02 02:46:19PM
Ok, this has been available since the NeXT days, but can someone describe in detail how to set up a User's Home Directory on a Network box using only OS X Client boxes? I already have an OS X (client) box sitting up in the attic, and would like my family to have roaming profiles so that their setup is the same regardless of the machine they use. I would also like to use the server to manage accounts, so I don't have to create an account for each family member on each machine.

I know the book Mac OS X Unleashed has a description of the process, but I've never seen it described on any sites like this one.

Thanks.

[ Reply to This | # ]