Some of you may know this, I got it a friend. It allows you to have a different pre-selected desktop come up each time you start up your computer.
He did testing and the only 'issue' you could say is that doing it this way works best with pictures that are in bmp format. Jpeg's, jpg's etc seem to have a few issues (such as they don't display!!).... why? I don't really know.
But anyway if this isn't a problem then this script is pretty good.
Note: I got this a while ago from the Hey, Scripting Guy! website.
I have modified it a bit so I can add any other functionality if I need to.
Just copy and past the following code into a text file and save it as 'WallpaperChanger.vbs'. To edit it, right click and choose edit.
Now depending on how many pictures you want to have as possible wallpapers will determine the value of 'lngHighNumber' at the top. Its currently set to 6.Code:Option Explicit Const HKEY_CURRENT_USER = &H80000001 dim strComputer, strValue, strKeyPath, strValueName dim lngLowNumber, lngHighNumber, lngNumber dim objReg strComputer = "." Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") lngLowNumber = 1 lngHighNumber = 6 Randomize lngNumber = Int((lngHighNumber - lngLowNumber + 1) * Rnd + lngLowNumber) Select Case lngNumber Case 1 strValue = FilePath Case 2 strValue = FilePath Case 3 strValue = FilePath Case 4 strValue = FilePath Case 5 strValue = filepath Case 6 strvalue = filepath End Select strKeyPath = "Control Panel\Desktop" strValueName = "Wallpaper" objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
When you change this number you also have to edit the 'case' statement. If you have 10 pictures the case statement will go 'Case 7', 'Case 8' etc up to 10. Where I have the word 'filepath' you will have to put the filepath (funnily enough) of the pictures you want to display. Each Case will only have 1 filepath.
Example:
That should be about it for the coding side of things. Just save the file in a logical location.Code:Case 1 strValue = "C:/Pictures/Picture1.bmp" Case 2 strValue = "C:/Pictures/Picture2.bmp" etc etc
Just put a shortcut to it in start > All Programs > Startup.
It's a bit of work but this is the longest bit plus it saves CPU and stuff.
Enjoy!
Remember, the pictures you use have to be saved in the .bmp format, or else you'll just have a black desktop...and no one wants that.






Reply With Quote




