Change the desktop picture on the second monitor

Hello,

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!

Regards

Stefan

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.

Greets

Ty

Ahem…

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 com.apple.desktop Background '{69670400 = {\"ImageFilePath\" = \"" & bgImg & "\";};}'"
tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preference.desktopscreeneffect"
	quit
end tell

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