0

I have set slideshow as my Windows 10 background. I can right click on the desktop and select Next desktop background to change it to the next image. Is there any way to do this via cmd or powershell considering my current Shuffle setting in slideshow (on or off)? I found that this item is located here in regedit and its data

HKEY_CLASSES_ROOT\DesktopBackground\shellex\ContextMenuHandlers\DesktopSlideshow

but couldn't find any way to run it.

I need to run this by command

  • Don't ask more or less duplicate questions, please: https://superuser.com/questions/1780782/how-to-change-theme-background-settings-in-windows-10-automatically-or-with-one – Destroy666 Apr 26 '23 at 11:29

2 Answers2

2

It's possible to automate "Next desktop background" using the free AutoHotkey.

The following script will change to the next image in the slideshow when pressing Ctrl+F10:

^F10::
try if ((pDesktopWallpaper := ComObjCreate("{C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD}", "{B92B56A9-8B55-4E14-9A89-0199BBB6F93B}"))) {
    DllCall(NumGet(NumGet(pDesktopWallpaper+0)+16*A_PtrSize), "Ptr", pDesktopWallpaper, "Ptr", 0, "UInt", 0) ; IDesktopWallpaper::AdvanceSlideshow - https://msdn.microsoft.com/en-us/library/windows/desktop/hh706947(v=vs.85).aspx
    ObjRelease(pDesktopWallpaper)
}

After installing AutoHotKey, put the above text in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at
C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

Useful AutoHotkey documentation:

Reference : A subroutine to switch to the next background (Windows 10).

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Thank you. I do not like the idea to keep a Autohotkey script running, since I will use this feature only specific times. I just removed keycodes and add add ExitApp so it is now one time executable. I would like to know if it is possible to switch Shuffle setting between 0 and 1 with Autohotkey, in this script? I normally keep shuffle on but I want to have this script to pass next background in order (not shuffled order)? – Halil Nebioğlu Apr 27 '23 at 22:07
0

Update to harrymc's answer above for anyone else struggling to get this working in AutoHotKeyV2 this is the code you you need :-

#Requires AutoHotkey v2.0
try if ((pDesktopWallpaper := ComObject("{C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD}", "{B92B56A9-8B55-4E14-9A89-0199BBB6F93B}"))) {
        ComCall(16, pDesktopWallpaper, "Ptr", 0, "UInt", 0) 
        ObjRelease(pDesktopWallpaper)
}
Kev
  • 111
  • 3