How do I: Rotate Wallpapers?
How do I: Rotate Wallpapers?
I have been searching through the forum to find some code that I can manipulate into what I am looking for but having some trouble. Most of what I am finding has a ton of features. All I need is a simple script to change a wallpaper every 'x' minutes from a local folder.
For instance
Windows 10 operating system
C:\Pictures - has a batch of PNG wallpapers in it
Need AHK to cycle through the images at a specific intervals
5 minutes
Loop forever
Help please?
For instance
Windows 10 operating system
C:\Pictures - has a batch of PNG wallpapers in it
Need AHK to cycle through the images at a specific intervals
5 minutes
Loop forever
Help please?
Re: How do I: Rotate Wallpapers?
Code: Select all
#Persistent
minutes := 1, dir := "D:\images", image := [], regKey := "HKEY_CURRENT_USER\Control Panel\Desktop"
RegWrite, REG_SZ, %regKey%, WallpaperStyle, 1
Loop, Files, %dir%\*.bmp
image.Push(A_LoopFilePath)
SetTimer, Change, % 1000* 60 * minutes
Change:
image.Push(thisImage := image.RemoveAt(1))
RegWrite, REG_SZ, %regKey%, Wallpaper, %thisImage%
RunWait, RUNDLL32.EXE user32.dll`,UpdatePerUserSystemParameters
SoundBeep, 1500
Return
Re: How do I: Rotate Wallpapers?
that is awesome, I didn't see the sound beep at first and was like why is it beeping? Appreciate the help.
One more question - anyway to make it only change the wallpaper on screen number 2?
One more question - anyway to make it only change the wallpaper on screen number 2?
Re: How do I: Rotate Wallpapers?
That is awesome!
One more question any way to make it only change the wallpaper on screen 2?
One more question any way to make it only change the wallpaper on screen 2?
Re: How do I: Rotate Wallpapers?
Very good. I am not sure about the monitor-specific changes. A general Internet search or forum search might reveal the answer.
Re: How do I: Rotate Wallpapers?
Check out Display Fusion. I use it & love it. Free version will do exactly that and a lot more. (I am not affiliated with the company, just like their products.)
[Edit] - Oops, my bad. I misread their web site on free vs. paid features. That capability is not available in the free version - sorry - only in the paid one.
[Edit] - Oops, my bad. I misread their web site on free vs. paid features. That capability is not available in the free version - sorry - only in the paid one.
Last edited by RussF on 15 Sep 2021, 13:31, edited 1 time in total.
- flyingDman
- Posts: 2817
- Joined: 29 Sep 2013, 19:01
Re: How do I: Rotate Wallpapers?
Re: Q1: Without using RegWrite:
Code: Select all
#persistent
arr := [], cnt := 1, mnts := 10
loop, files, C:\Users\xxx\Pictures\Wallpaper\*.png
arr.push(A_LoopFileFullPath)
SetTimer, Change, % 1000*60*mnts
change:
DllCall("SystemParametersInfo",UInt,0x0014,UInt,0,Str,arr[cnt],UInt,2)
cnt := cnt = arr.count() ? 1 : ++cnt
return
14.3 & 1.3.7
Re: How do I: Rotate Wallpapers?
Anyway to make this only operate on Monitor number 2? I found a autobackground AHK but it is from 2006 it uses WM_DISPLAYCHANGE(0,0) and has the following code. But these monitors wont be changing this is a static secondary monitor that I want the wallpaper to change on at intervals.
Code: Select all
;AutoBackground
;tom at 3shizzletones.com (take out the shizzle)
; http://www.3tones.com
;
;Built with AutoHotKey v1.0.44.10 and tested on Windows XP
; http://www.autohotkey.com
;
;9/21/06
;added style function
;change method of changing background to using a dllcall
;check background on login
WM_DISPLAYCHANGE(0,0)
OnMessage(0x7E, "WM_DISPLAYCHANGE")
return
WM_DISPLAYCHANGE(wParam, lParam)
{
;WM_DISPLAYCHANGE is triggered any time a change is made to the display settings
;get the monitor count
SysGet, mc, MonitorCount
if mc = 1
{
;if 1 monitor, use this background
background_file = C:\Documents and Settings\user\My Documents\My Pictures\serenade.bmp
;set tile and style accordingly
SetWallpaperStyle("Tiled")
;set background file
DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, background_file, UInt, 2)
}
else if mc = 2
{
;if 2 monitors, use this background
background_file = C:\Documents and Settings\user\My Documents\My Pictures\reverie2x.bmp
;set tile and style accordingly
SetWallpaperStyle("Tiled")
;set background file
DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, background_file, UInt, 2)
}
}
SetWallpaperStyle(style)
{
;for tiled, use TileWallpaper=1 WallpaperStyle=0
;for centered, use TileWallpaper=0 WallpaperStyle=0
;for strech, use TileWallpaper=0 WallpaperStyle=2
if style=Tiled
{
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, TileWallpaper, 1
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, WallpaperStyle, 0
}
else if style=Centered
{
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, TileWallpaper, 0
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, WallpaperStyle, 0
}
else if style=Streched
{
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, TileWallpaper, 0
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, WallpaperStyle, 2
}
}