Thanks, but the drag and drop thing is a bit annoying.
To make it a bit less inconvenient, move the file to
/Library/Desktop Pictures
(note: you will need to authenticate when prompted in order to save into the 'Desktop Pictures' folder),
then drag the folder 'Desktop Pictures' to the Finder sidebar to make a convenient shortcut.
Now when you want to change all Desktop images, click in 'Desktop Pictures' in the Finder sidebar, click this file, and drag image from the (already) open Finder window. If you save all your Wallpapers in this location then there'll all be in one spot and the window open when you run the program
I've changed the script slightly from above to include the escape sequence, as many people aren't familiar with Terminal, so what if...
1. I ran the script but now I don't want to use it?
If you change your mind or select the wrong file, you can use 'control-c' to kill the script without making the change. If you don't enter anything but press 'return', you'll change all the wallpapers back to the default galaxy pic, so the 'control-c' trick is worth knowing.
2. I dropped the wrong file onto Terminal?
If you drop the wrong file and want to chose another one, just keeping pressing the 'delete' key till its removed from the command line, then drop the correct file. Alternatively, you can still use 'control-c' to kill the script at any time before you hit 'return'.
Here's the slightly changed script:
#! /bin/bash
#script to change all desktop backgrounds
echo -n "Drag and drop an image file here then press 'return' or
press 'control-c' to cancel..."
read -e WLPR;
function change_wallpaper
{
defaults write com.apple.desktop Background "{default = {ImageFilePath='$WLPR'; };}"; killall Dock
}
change_wallpaper
###################
#after testing, save this program in /Library/Desktop Pictures
#drag the folder 'Desktop Pictures' to the Finder sidebar
#now when you want to change all Desktop images, click in 'Desktop Pictures'
#in Finder, click this file, and drag image from the open Finder window
#note: you will need to authenticate when prompted
#in order to save into the 'Desktop Pictures' folder
###################