This Automatic Wallpaper Changer was written specifically for a AutoHotkey Forum Topic. The required files (in addition to the script) has been compressed into Auto-WPC[20060106000003].zip which can be downloaded by clicking here. Beforehand, take time to read this page to know exactly what you are downloading.. Thank you - Goyyah
Automatic Wallpaper Changer [Auto-WPC.AHK] is written as a AutoHotkey Script. You have to install the AutoHotkey Software prior to running any AutoHotkey Script [Text file with .AHK extension]. AutoHotkey is a free, open-source utility for Windows. For more details about AutoHotkey visit www.autohotkey.com

The Auto-WPC Script runs a external program i_view32.exe for setting the wallpaper. i_view32.exe is the main executable of IrfanView [one of the most popular image viewers worldwide].
The Auto-WPC Script will refuse to load if it is not run from the same folder where i_view32.exe is available. The main executable of IrfanView i_view32.exe weighs just 424Kb [Version 3.97]. IrfanView is an excellent graphic viewer software offering a long list of Command Line Options which extends multimedia capabilities to Scripts.

For latest version visit irfanview.com. Click above image.
Download IrfanView 3.97 [874Kb]
IrfanView is a very fast, small, compact and innovative FREEWARE (for non-commercial use) graphic viewer for Windows 9x/ME/NT/2000/XP/2003.
Supported file formats: AIF, ANI/CUR, ASF, AU/SND, AVI, B3D, BMP/DIB, CAD formats, CLP, DDS, Dicom/ACR, DJVU, ECW, EMF/WMF, EPS, FITS, FPX (FlashPix), FSH, G3, GIF, ICO/ICL/EXE/DLL, IFF/LBM, IMG (GEM), JPG2000, JPG, JPM, KDC, LDF, LWF, MED, MID/RMI, MNG/JNG, MOV, MP3, MPG, MrSID, NLM/NOL/NGG, OGG, PBM/PGM/PPM, PCX/DCX, PhotoCD, PNG, PSD, PSP, RAS/SUN, RAW, Real Audio (RA), RLE, SFF, SFW, SGI/RGB, SWF (Flash 4), TGA, TIF, TTF, TXT, WAD, WAV, WBMP, XBM, XPM, CRW/CR2, DNG, NEF, ORF, RAF, MRW, DCR, X3F, PEF, SRF, EFF, DXF, DWG, HPGL etc.

A Screen-Capture of the Tray Menu
Simply put, my script does one thing, it keeps changing the wallpapers with a preset duration. It takes the image file's name from a text file (which is conceptually similar to a .M3U playlist) and passes the filename as a parameter to IrfanView executable which takes care of setting the wallpaper.
Creating a list of images would be tedious if I expect the end-user to type each filename (that too with full path!). So my script scans a folder (or a whole drive) and creates the list. Seen on the left side is a Screen-Capture of the Tray Menu. I will refer it as "Pop-Up Menu" because it pops up near the top-left of desktop when the mouse is exactly at the top-left of the screen. Only the first four options on the Pop-Up Menu will be relevant to the subject for which this Script was written for, i.e., Automatic wallpaper changing. Let me explain the Menu Options quickly

Open, Opens up the "List of Images" text file (for manual entries/modification)
Create/Add, creates (or adds to the existing) "List of Images" text file
Sound ON/OFF, A wave file (Camera Click) will be played when turned ON
Tooltip Display ON/OFF, Displays the name of the Image file (which is currently being set as wallpaper) when ON
Visit the Webpage, That's where we are!
e-Mail Goyyah, Goyyah is me! and I love to hear...
Check for an Update, let me explain it separately
Fetch External IP Address, Originally it is a included sub-routine to ascertain whether the end-user is connected to the Internet, so as to enable automatic updation of the script.
Backup a copy, is also a sub-routine required by automatic updation routine
Readme.txt, will be updated along with the script whenever the user opts for it.
Exit, is the default item of the Menu. So "Double Clicking" the tray icon will close the script.

Check for an Update, is an option that I originally included for my friends who are using an another (rather messy!) variant of this script. I decided to put it up in this script, on hope that it would also benefit someone in the forum. It is for demonstration purpose, though anyone can really use it, if they decide to stick on to original code. I will include/modify any valuable suggestions/modifications from my AHK folk to this script.
This option downloads the script from web, checks for version, back's up the current script, replaces it with a new one, and reloads it. That`s it .. Script is updated on-the-fly. Try renaming the Script. It will still work!. The user may at any time retrieve the older copy from the backup folder.


The minimum requirement of Auto-WPC.AHK is only i_view32.exe. No .INI files or whatsoever.
The following files are supplementary to the Script
Clicking.wav - If present in the script's directory, plays it when a wall paper is being changed!
Auto_WPC.ico - The tray menu ICON
Readme.txt - Info on the script

User-Modifiable %Variables%
The early lines of the script initialises various variables which control the program flow

Duration=1

Duration is the variable that controls the time-gap (in minutes) between the two wallpaper changes. It can be as low as .1 (6 seconds) and as high as 60 minutes. (see RepeatList)

ListFile=MyFavouriteImages.txt

ListFile is the Variable that holds the name of the "List of Images" text file. It is also reflected in the Pop-Up menu (as seen in the Screen-Capture)

WallpaperSetType=2

WallpaperSetType holds a parameter for IrfanView. '0' is for Centering the wallpaper, '1' for Tiling the wallpaper and '2' for setting a Stretched wallpaper.

SetRandomWallpaper=1

SetRandomWallpaper 'evaluates to a logical true' when it is =1 and it randomizes the "List of Images" text file and saves it to RandList.txt ( Note: RandList.txt is created irrespective of this setting, because invalid entries (non existent images), if any, should be removed and a new list has to be created. SetRandomWallpaper controls whether the new listing is randomized)

RepeatList=1

RepeatList 'evaluates to a logical true' when it is =1 and it keeps repeating the RandList.txt until the user opts to Exit. (Duration=.1 and RepeatList=0 runs "List of Images" text file as a Desktop Slideshow and exits.

MinimizeAllWindows=1

MinimizeAllWindows is reserved for future use

ChangeWallpaperOnExit=1
WallPaperOnExit=SomeImage.GIF


These two variables are supplementary in running this script as a Desktop Slideshow. The user may have a 'most preferred' wallpaper which will be set as the wallpaper whenever Auto-WPC exits.

DisplayTooltip=1
TooltipDisplayDuration=1000


DisplayTooltip 'evaluates to a logical true' when it is =1 and displays the name of the 'would be' wallpaper. TooltipDisplayDuration controls the duration of the file name to display (in milliseconds)

Play_A_Wave_Sound=1
WaveFileName=Clicking.Wav


These variables control whether the script plays a sound when the wallpaper is being changed. The default Clicking.wav provided with the script has a 500 millisecond silence in the beginning to synchronise with Irfanview. Also I have reduced the volume by 75% so that it does irritate over a period of time.

The 'Tooltip name display' and 'Play a Sound' has been implemented in this
script to notify the user when a wallpaper is being changed"

The following Variables controls the Creation of/Addition to the "List of Images" text file

ValidImageExtensions=|JPG|PNG|BMP|GIF|
RecurseSubFolders=1
MinJPGSize=100
MinBMPSize=1440
MinPNGSize=500
MinGIFSize=200
OverWriteMode=1

Whenever the "List of Images" text file is missing (as the case is when the script is run for the first time) "the Browse for Folder" dialog opens up (as seen in the left) prompting user to Select a Folder Containing Images. Select a Folder/Drive and the script starts writing to the "List of Images" text file. The script checks whether the extension of a file is in ValidImageExtensions variable, and adds the file name to the List. However, when I was testing the script on Drive C:, the script's routine kept adding all kinds of tiny files it found in the Temporary Internet Folder. So, it was neccessary to have a control on the file size of the images.
The format for such a variable is
Min<FileExtension>Size=


for example:
If you want to add the extension ABC, modify
ValidImageExtensions=|JPG|PNG|BMP|GIF|ABC
and add the following Variable
MinABCSize=
RecurseSubFolders variable controls whether the Subfolders are also "Scanned" for images. OverWriteMode 'evaluates to a logical true' when it is =1 and "List of Images" text file is sent to the Recycle Bin whenever 'Create a New' option is selected in the Pop-Up menu. The 'Create a New' option will be itemized as 'Add to' (in the Pop-Up menu) if this variable is set to 0 (zero).

 

and that is all for now....

 

I have got something to declare. I am not a good Programmer. After going through code, an experienced Programmer will/might find my code irritating at places (maybe at many places). My problem is that "I am not able to unlearn". If I cannot write one single complex line of code, I break it into 3!. I've been doing it for a long time. I dont know C, Visual Basic, or Delphi. Even in AutoHotkey, The DllCall sounds like Greek and Latin to me. If not for some "good guys" at the Autohotkey Forum who help me, none of my scripts would have the DllCall function. Goyyah [ arian.suresh@gmail.com ]

 

 

1