How can I manually switch to the next Desktop wallpaper in Mojave? I have attempted to use this AppleScript to to cause the Desktop wallpaper to change to the next image in the folder of images that has been selected in System Preferences. It does not work for me in Mojave, the current Desktop wallpaper remains unchanged.

Since I am unfamiliar with AppleScript, it might be that I am doing something wrong. I have copy/pasted the script into the Script Editor and clicked the Run button. I have also saved the script as an application and double clicked it from the Desktop.

Here is the version of the script that I am using:

tell application "System Events"
    tell current desktop
        set currentInterval to get change interval
        set change interval to currentInterval
    end tell
end tell


Any thoughts?
If you are simply looking to change your desktop wallpaper quickly, this following AppleScript code should do the trick. As it is now, the code is set to only choose the pictures from your desktop pictures folder.  To be able to use a different folder for your desktop pictures, you can certainly play around with the code

This works for me using the latest version of macOS Mojave

tell application "System Events"
    set fileRef to a reference to files of desktop pictures folder
    set picPath to path of fileRef
    tell current desktop
        set currentPic to get picture as POSIX file as text
        set theIndex to my indexOfItemInList(currentPic, picPath)
        try
            set picture to item (theIndex + 1) of picPath
        on error errMsg number errNum
            set theIndex to 0
            set picture to item (theIndex + 1) of picPath
        end try
    end tell
end tell

(* THIS HANDLER DETERMINES THE INDEX OF THE CURRENT DESKTOP PICTURE
IN THE LIST OF AVAILABLE DESKTOP PICTURES, TO BE ABLE TO QUICKLY SET
THE NEW DESKTOP PICTURE TO THE NEXT ONE IN THE LIST*)

on indexOfItemInList(theItem, theList)
    script fasterList
        property fastList : theList
    end script
    repeat with i from 1 to length of fasterList's fastList
        try
            if item i of fasterList's fastList = theItem then return i
        on error "Item not found." number -1728 from theItem
            tell application "System Events"
                tell current desktop
                    set picture to item 10 of picPath
                end tell
            end tell
        end try
    end repeat
end indexOfItemInList




You mentioned “The Change Picture Every XXX option needs to be checked in Desktop Preferences. “, in your comment.  I'm not quite sure why because the above AppleScript code works on my system without that being checked.  However if having that option to be enabled is necessary, this following AppleScript code will do that for you



if application "System Preferences" is running then do shell script "killall 'System Preferences'"
repeat until application "System Preferences" is not running
    delay 0.1
end repeat
tell application "System Preferences"
    reveal anchor "DesktopPref" of pane id "com.apple.preference.desktopscreeneffect"
    activate
end tell
tell application "System Events" to tell application process "System Preferences"
    repeat while not (exists of static text 1 of row 2 of outline 1 of scroll area 1 of tab group 1 of window "Desktop &amp; Screen Saver")
        delay 0.1
    end repeat
    set focused of static text "Desktop Pictures" of row 2 of outline 1 of scroll area 1 of tab group 1 of window "Desktop &amp; Screen Saver" to true
    if (get value of checkbox 1 of tab group 1 of window 1) is 0 then
        click checkbox 1 of tab group 1 of window 1
    end if
end tell
if application "System Preferences" is running then do shell script "killall 'System Preferences'"