I just try to add minor seasonings to John's script. I try to make the script capable to change wallpaper once every minute according to the time of the day. For example, from 5.00 to 8.59, it changes several wallpapers with morning theme; from 9.00 to 13.59, it changes several wallpapers with midday theme; and so forth. Every theme in this script contains 4 BMP images. Since there are five themes included in the script (morning, midday, afternoon, evening, and night), there will be 20 images required for this script to work.
'creating procedure that changes wallpaper every minute
Sub ChangeWallpaperPerMinute ()
Set obshell = WScript.CreateObject("Wscript.Shell")
CurrentHour = Hour(Now)
'determining the number of images for every time of the day-based theme (set the 'maximum' value according to the number of images for every theme)
maximum=4
minimum=1
'randomizing the images to be changed
Randomize
num = Int((maximum-minimum+1)*Rnd+minimum)
If CurrentHour >= 5 And CurrentHour <= 8 Then
wallpaper = "morning" & num & ".bmp"
ElseIf CurrentHour >= 9 And CurrentHour <= 13 Then
wallpaper = "midday" & num & ".bmp"
ElseIf CurrentHour >= 14 And CurrentHour <= 16 Then
wallpaper = "afternoon" & num & ".bmp"
ElseIf CurrentHour >= 17 And CurrentHour <= 20 Then
wallpaper = "evening" & num & ".bmp"
ElseIf CurrentHour >= 21 And CurrentHour <= 23 Then
wallpaper = "night" & num & ".bmp"
ElseIf CurrentHour >= 0 And CurrentHour <= 4 Then
wallpaper = "night" & num & ".bmp"
Else
WScript.Quit(0)
End If
obshell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper",wallpaper
obshell.Run "%windir%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters",1,False
Set obshell = Nothing
End Sub
'end of procedure creation'
'calling procedure to initiate script's action
ChangeWallpaperPerMinute
'repeating the calling of procedure
do
WScript.sleep(60 * 1000)
'60 * 1000 means sixty seconds. If the shifting of wallpapers is expected to occur once every ten seconds, change to 10 * 1000
'calling procedure
ChangeWallpaperPerMinute
Loop
To make this script operable, in addition to the script file itself, 20 BMP images are also needed. Four of those images must be named according to the specified nomenclature; that is, for example, morning1.bmp, morning2.bmp, morning3.bmp, and morning4.bmp. The same nomenclature also applies on the naming of 4 midday images, 4 afternoon images, 4 evening images, and 4 night images. Put the VBS file along with the 20 image files in one folder. Because this script repeatedly calls its procedure at specified intervals, when you use scheduled tasks, be sure that you activate this script only at system logon. To deactivate this script, just kill wscript.exe using task manager.