I have been playing with Python recently.
Here is a little script to change a mac’s desktop wallpaper to the file specified as the first argument of the script:
import subprocess,sys,os
# Raw apple script
Script = """/usr/bin/osascript<<END
tell application "Finder"
set desktop picture to POSIX file "%s"
end tell
END"""
# get the file name which is the first argument passed to this [...]