I've been working at this for a little while, and I would like to be able the change my desktop according to what day of the week it is. Right now I am getting a 'Wrong number of arguments or invalid property assignments: 'weekday'' at line 14, character 1:
Here is the whole script:
If anyone has any ideas or suggestions I'd appreciate the input! This is for my local computer, so there is no security hazards of any kind. Obviously all the images are different, I just used the xxxx.jpg for testing purposes.
Thank you!
Code:
set day = weekday
Here is the whole script:
Code:
'##########################################################
'#Writen by
'#Changes desktop wallpaper according to the day of the week.
'##########################################################
dim wshShell
dim sUserName
Set wshShell = WScript.CreateObject("WScript.Shell")
sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
set day = weekday
'##########################################################
'#Create an else case to determine day of the week
'#WeekdayName 1 = Sunday default start day of the week
'##########################################################
Select Case day
case 1
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
case 2
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
case 3
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
case 4
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
case 5
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
case 6
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
case else
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Documents and Settings\xxxx\My Documents\My Pictures\CharacterDesktops\xxxx.jpg"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
end select
wscript.quit
If anyone has any ideas or suggestions I'd appreciate the input! This is for my local computer, so there is no security hazards of any kind. Obviously all the images are different, I just used the xxxx.jpg for testing purposes.
Thank you!