|
LITTLEBLACKDOG.COM
|
| Author |
Message |
T
Curmudgeon

Joined: 17 May 2001 Posts: 16187
Location: Airstrip One
|
Posted:
Sat Aug 16, 2003 5:57 pm Post subject: Open-source wallpaper changer |
|
I got bored trying to find a good program which would randomly change my wallpaper each time I sign in.
So I wrote my own:
==========
; This KiX script will read into memory a list of all files in a specific directory
; and then choose one of them at (pseudo-)random to be the current wallpaper.
; It will also change the default wallpaper, shown before anyone logs in.
; While later versions of Windows allow files other than .BMP to be used as wallpaper
; all that really happens is that Windows converts the chosen file into .BMP format
; before applying the change.
; You must make sure that all the files in the directory are .BMP format if you want
; this script to work as intended.
; If you use the GUI program WKIX32.EXE you can get this script to run with no visible
; indication, compared with the console program KIX32.EXE which displays a console
; window, even if only for a fraction of a second.
; To get this to run automatically you have three choices:
; 1) Create a shortcut pointing to "C:\KIX\KIX32.EXE" "C:\KIX\WALLPAPER.KIX"
; Feel free to edit the paths to reflect the locations you've chosen
; Also feel free to change the filename to WKIX32.EXE as outlined above
; Put the shortcut into the Start Menu\Programs\Startup folder for either
; the currently logged on profile so that it runs only for the current user
; or in the All Users profile to affect everyone who uses the computer
;
; 2) Edit the Registry for the current logged-on user.
; Drill down to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
; Create a new value in that key with the contents "C:\KIX\KIX32.EXE" "C:\KIX\WALLPAPER.KIX"
; As above, feel free to change the paths and the executable to suit your needs
; This will run for the currently-logged on user only
;
; 3) As above, but edit the Registry so that it affects all users
; The relevant key is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
; This will run regardless of who logs on.
; Lastly, this script file with all of these comments is huge. The script I use has no
; comments and is about 512 bytes. This commented version is approximately 4 kilobytes.
; Feel free to delete all comments (they begin with the ; character) to reduce the loading
; time of the script
; Edit the next line of code to change the location where the .BMP files are kept.
; The only files permitted in this directory are .BMP files.
$FileName = Dir("E:\Wallpaper")
; This next section reads in the name of each file in the directory and concatenates
; them into a string, separating each filename with the delimiter ~~~
; It also keeps a total of the number of files found
$FileCount = 0
While $FileName <> "" and @ERROR = 0
$FileCount = $FileCount + 1
$FileName = $FileName + "~~~" + Dir() ; retrieve next file
Loop
; The virtual directories "." and ".." are caught by the script. They are always the
; first two entries. Consequently it is necessary to reduce the file count by 2
$FileCount = $FileCount - 2
; Now we split the concatednated string into an array, using ~~~ as the delimiter
$WallpaperArray = Split ($Filename, "~~~")
; KiX's random number generator is rather poor, but it suffices for this. The next
; command seeds the pseudo-random generator with the number of milliseconds elapsed
; since the system was started. One can use the macro @MSECS instead.
srnd(@TICKS)
; Pick a random number between 0 and the number of files found (not forgetting that
; we have adjusted the number of files found to account for "." and "..")
$WallpaperIndex = rnd($FileCount) + 2
; Add two to it because the first two entries in the array are always "." and ".."
$WallpaperName = "E:\Wallpaper\" + $WallpaperArray[$WallpaperIndex]
; Change the current user's wallpaper. If you don't want the change to be permanent -
; i.e. you want the wallpaper to revert back to its previous setting when the user
; logs off then change the 1 in the code to a 0, i.e. $rc = SetWallpaper($WallpaperName,0)
$rc = SetWallpaper($WallpaperName,1)
; Change the default (before anyone logs in) wallpaper - feel free to delete
; this instruction if you don't want the default wallpaper changed
$rc = writevalue("HKU\.DEFAULT\Control Panel\Desktop","Wallpaper",$WallpaperName,"REG_SZ")
==========
You'll need the KiX interpreter to run this, which you can get from http://www.kixtart.org/ |
_________________ Got questions? Click here.
Still got questions? Click here, too.
affabletoaster, Akely, anglachel, blahpony, CMTG, EdisonRex, Elk, Equin, evilness, Fido, fathertyme, Goddess, Jaymac, je, jodygirl, KingKobra, Lycander, mally, Max, OhioArt2, perrito_blanco, Rover, Spot, sully_51, Superdwarf, the taz man, thriftyjack, twiztid, wrathiron, yiayia49
Would you like good music at a price that is right? CD Baby, baby.
You look like you need a monkey.
|
|
|
|
|
hohlecow
Tail-Wagger


Joined: 17 May 2002 Posts: 2151
Location: hungary for turkey and chile
|
Posted:
Thu Aug 21, 2003 6:24 am Post subject: |
|
when i bought my vaio, 4 years ago, the default wallpaper was an html file that changed the image depending on the time of day using javascript. at the time i thought it was so awesome, the vaio logo reflecting the time of day. too bad it required active desktop, which at the time would take any decent system and reduce it to a little more then typewriter with a true color display. |
_________________ give as much as you can, and take nothing
sometimes i think if zombies were attacking us, liberals would be fighting for thier rights, "they eat brains for fuel, it's part of who they are" or "we can't descriminate against them, that's just the way they were reanimated."
trying it again: POTD (picture of the day)
|
|
|
|
|
T
Curmudgeon

Joined: 17 May 2001 Posts: 16187
Location: Airstrip One
|
Posted:
Thu Dec 11, 2003 5:27 pm Post subject: |
|
You can set this as a scheduled Task, so that your wallpaper changes at random at an interval of your choice.
Or so I discovered today. Hurrah! |
_________________ Got questions? Click here.
Still got questions? Click here, too.
affabletoaster, Akely, anglachel, blahpony, CMTG, EdisonRex, Elk, Equin, evilness, Fido, fathertyme, Goddess, Jaymac, je, jodygirl, KingKobra, Lycander, mally, Max, OhioArt2, perrito_blanco, Rover, Spot, sully_51, Superdwarf, the taz man, thriftyjack, twiztid, wrathiron, yiayia49
Would you like good music at a price that is right? CD Baby, baby.
You look like you need a monkey.
|
|
|
|
|
|
|
|
|
View next topic
View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB
© 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours
Help us keep advertisements off this site. Donate today!
|
|