Change the desktop picture on the second monitor


could someone tell how to change the desktop picture of the second monitor from within an apple script?

Is there a way to do this?

Thanks for your help!



I think you would have to UI script it in window 2 of the desktop preferences pane. I have two monitors, but have never tried it - will look into it.

Thank you for your help.

I found another way that works for me but, this is also very nice.




Btw your script does not work for me.
It produces no error, but also doesn’t change the background…

Strange… :confused:

This is my script:

set bgImg to POSIX path of (choose file default location alias "MacSystem:Library:Desktop Pictures:") as text
do shell script "defaults write Background '{69670400 = {\"ImageFilePath\" = \"" & bgImg & "\";};}'"
tell application "System Preferences"
	set current pane to pane ""
end tell

Note: I want both displays to have the same background so this works fine for me. :slight_smile: