VBScript change windows wallpaper


‘INFO
‘Die Wallpaper müssen .bmp Endung haben sonst geht es NICHT
Dim WshShell, oArgs
Set WshShell = WScript.CreateObject("Wscript.Shell")
set oArgs=wscript.arguments

‘inizialisieren für Random hier 4 Wallpaper

intLowNumber = 1
intHighNumber = 4

Randomize
‘Random generieren

intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
‘Switch Case des Random bereitstellen

Select Case intNumber
Case 1
'In die Regestri das neue Wallpaper schreiben
WshShell.RegWrite "HKCUControl PanelDesktopWallpaper", "P:Eigene Bilderhydrogen3.bmp"
'Dem System sagen das etwas neues geschriben wurde - Updaten
WshShell.Run "%windir%System32RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False
Case 2
WshShell.RegWrite "HKCUControl PanelDesktopWallpaper", "P:Eigene Bilderhydrogen5.bmp"
WshShell.Run "%windir%System32RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False
Case 3
WshShell.RegWrite "HKCUControl PanelDesktopWallpaper", "P:Eigene Bilderzodiacal_light.bmp"
WshShell.Run "%windir%System32RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False
Case 4
WshShell.RegWrite "HKCUControl PanelDesktopWallpaper", "P:Eigene Bilderwiese2.bmp"
WshShell.Run "%windir%System32RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False
End Select
Set WshShell = Nothing