Query by dheim96: I am attempting to make a VBS script to download a file from the internet and apply the picture as a background?
This is the code that I have for the VB script to download a file from the web then apply it as a desktop background. But it will not operate. Can everyone inform me what went wrong?
dim ie
set ie.createobject(“internetexplorer”)
ie.visible=false
ie.navigateto(““)
do while ie.busy=true
wscript.sleep 60
loop
ie.document.execwb(“saveas”,two,C:/temp/hoff-18187.jpg”)
ie.quit
Dim WshShell
Set WshShell = WScript.CreateObject(“Wscript.Shell”)
WshShell.RegWrite “HKCUControl PanelDesktopWallpaper”, hoff-18187.jpg
WshShell.Run “%windir%System32RUNDLL32.EXE user32.dll,
UpdatePerUserSystemParameters”, 1, False
Set WshShell = Nothing
Finest answer:
Answer by Mehdi
Do you get an error message?
Also, Yahoo! clips the code.
Repost it with spaces about all the ( and ), and following each comma.
Ahead of that, though, I see…
WshShell.RegWrite “HKCUControl PanelDesktopWallpaper”, hoff-18187.jpg
There is no quotes around the string hoff-18187.jpg, so VBS thinks it is a variable with no worth attached to it. Add quotes and see if that functions.
Know better? Leave your very own answer in the comments!