I have tried many different approaches to solving this problem. I’ve tried a KM only solution, but cannot get the pop-up to work in the the way I’ve done before, clicking on an image. I’ve tried an AppleScript only approach, but even using UI browser, I can’t manipulate the shuffle frequency popup. All I want to do is to select the frequency from the UI in the Wallpaper Preference pane, but whenever I try to set it to some different value, the screen changes, and breaks “Found Image”. I’ve tried positioning via the “Move and Click” KM action, but since generally resolutions on different screens are different, one single solution doesn’t work. So, I’m stumped. Here’s an attempt that doesn’t work, and one that does work, but not for the pane of interest.
My preference is to find a way to do this using Terminal, but I cannot find a command that does what I want. I’m open to suggestions.
Here are two techniques as examples. The first does not work, but the second does something similar for a different preference pane.
I dug into this a bit, and from what I found, you won't be able to set this via Terminal: Apple stores those shuffle values as binary blobs, for stupid reasons only Apple knows. Cynical Me would say they do it to make it impossible for users to change things programmatically.
So that leaves AppleScript, and UI scripting is horrid and I hate the syntax, so I always use an AI to help me find the right buttons. In this case, it was Claude that found the right mix of groups and splitters and scroll areas...
tell application "System Settings"
activate
delay 1
reveal pane id "com.apple.Wallpaper-Settings.extension"
delay 2
end tell
tell application "System Events"
tell process "System Settings"
-- Click the Shuffle popup button
click pop up button "Shuffle" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 0.5
-- Select your desired interval (change this line to your preference)
click menu item "Every 5 Minutes" of menu 1 of pop up button "Shuffle" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
end tell
end tell
delay 1
tell application "System Settings" to quit
Just to be 100% clear: The above code was written by Claude, not me. Use at your own risk, but I've tested it here, and it seems to work.
You can put any of the available options from the pop-up in the Every 5 Minutes string, but make sure you match the text exactly. Or you could set it in a Keyboard Maestro variable, then read that variable into AppleScript and set it based on the variable.
You may also have to play around with the delay lines to make things work, depending on the speed of your system.
You used to be able to do it via AppleScript and System Events, something like
tell application "System Events"
tell current desktop
set picture rotation to 1
set random order to true
set pictures folder to file "path:to:images:"
set change interval to 900 -- 15 mins in seconds
end tell
end tell
...but I think this got broken in Tahoe. I haven't tried hard, but I get a lot of missing values when trying to view any of the above settings.
There is a "Set Wallpaper" action in Shortcuts -- you could always fire that off every n minutes with the path to the next picture you want!
You could even skip Shortcuts and do this all in KM with the Set Desktop Image action. There are a few ways you coud randomise the next wallpaper at a particular path.
I tried. I asked Claude to compose an AppleScript to select the monitor in the wallpaper pane of system settings for macOS Tahoe 26.2, but it was unable to do so.
tell application "System Settings"
activate
delay 1
reveal pane id "com.apple.Wallpaper-Settings.extension"
delay 2
end tell
tell application "System Events"
tell process "System Settings"
-- Click the display selector dropdown
click pop up button 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 0.5
-- Type "P" to jump to PA27JCV
keystroke "p"
delay 0.2
-- Press return to select
key code 36 -- return
delay 2
-- Now set the shuffle time for this display
click pop up button "Shuffle" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 0.5
click menu item "Every 15 Minutes" of menu 1 of pop up button "Shuffle" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 1
end tell
end tell
tell application "System Settings" to quit
The caveat is that I was only able to make it work by doing type-selection in the menu. If I tried to access the menu by its name (PA27JCV), it didn't work. But typing 'P' and Return worked. You'll have to adjust the script for your display names, and if you have identical names, you'll probably have to use the arrow keys to navigate the menu.
Again, this was 99.5% Claude, but getting there took somewhat more back-and-forth; here's the chat:
Note that the script I posted above has an added delay after the activate that isn't in the final Claude version; without that, the panel doesn't have time to appear, and the script fails.
-- with everyone's help (including Claude), this works
-- Change the display names to conform to your configuration of coures.
---
tell application "System Settings"
activate
delay 1
reveal pane id "com.apple.Wallpaper-Settings.extension"
delay 2
end tell
tell application "System Events"
tell process "System Settings"
-- Click the Shuffle popup button
click pop up button "Shuffle" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 0.5
-- Select your desired interval (change this line to your preference)
click menu item "Every 15 Minutes" of menu 1 of pop up button "Shuffle" of group 1 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
--
delay 0.5
click pop up button 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 0.5
keystroke "DELL S3225QS"
delay 0.5
key code 36 -- return
delay 0.5
click pop up button 1 of group 1 of group 3 of splitter group 1 of group 1 of window 1
delay 0.5
keystroke "SE2717H/HX"
delay 0.5
key code 36 -- return
delay 0.5
end tell
end tell
delay 1
tell application "System Settings" to quit
```