I'm trying to write a simple script that will change my desktop background on all of my desktops/workspaces at once. Right now I have this:
tell application "System Events"
tell every desktop
set picture to "image.png"
end tell
end tell
This will change the wallpaper on both of my monitors for the desktop that is visible, but doesn't change the wallpaper on all of the 'hidden' desktops in Mission Control (Desktops 2-4 for example). Is there some way to modify this to enact on all desktops?
Best Answer
The following is a start until I figure out how to read the desktop count in Mission Control. Right now for this to work you must be on the farthest left Desktop.
Not knowing where your pic is located I'm targeting an image in
Desktop Pictures
with:I set a variable for the count of Mission Control Desktops:
I build a repeat loop starting with the first number till it reaches the count:
I use key code to move right with
control
only when the count is greater than 1 and a delay:I then reference every Desktop and add a delay on the picture to be set:
the complete code:
this is one way to do this hope it helps. This works and was tested using macOS High Sierra 10.13.6