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:
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 processSave 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:
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
#!/bin/tcshSave the script and make it executable, and then just launch the AppleScript to change all the desktop pictures at once.
# 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
•
[7,540 views]

