FileCreationTime=20060106000003 ; The first three lines facilitates the updation of this ;script from my webpage. WebLocation=http://www.geocities.com/venneye/Auto-WPC/ ;Do not alter or move it #Persistent ;---------------------------------------------------------------------------------------- ; Modify the Variable Values (to suit your needs) ;---------------------------------------------------------------------------------------- Duration=1 ; .1 to 60 Duration between Wallpaper Changes (In Mins) ListFile=MyFavouriteImages.Txt ; File name of the Image List WallpaperSetType=2 ; 0,1,2 0=Centered 1=Tiled 2=Stretched SetRandomWallpaper=1 ; 0 or 1 0 to Disable RepeatList=1 ; 0 or 1 0 to Disable MinimizeAllWindows=1 ; 0 or 1 0 to Disable ;- While exiting this Script you can set a Wallpaper of your preference ChangeWallpaperOnExit=1 ; 0 or 1 0 to Disable WallpaperOnExit WallPaperOnExit=SomeImage.GIF ; Wallpaper to set when script exits ;-While Wallpaper is changed, sound will be played the filename is shown as Tooltip DisplayTooltip=1 ; 0 or 1 0 to Disable TooltipDisplayDuration=1000 ; 500-5000 in MilliSeconds Play_A_Wave_Sound=1 ; 0 or 1 1 plays Clicking.Wav, 0 Mutes it WaveFileName=Clicking.Wav ; The Default Wave File ;---------------------------------------------------------------------------------------- ; Following Settings Influence Creation and Additions to "ListFile" ;---------------------------------------------------------------------------------------- ValidImageExtensions=|JPG|PNG|BMP|GIF| ; Leave this unmodified RecurseSubFolders=1 ; 0 to Disable MinJPGSize=100 ; in KiloBytes MinBMPSize=1440 ; in KiloBytes MinPNGSize=500 ; in KiloBytes MinGIFSize=200 ; in KiloBytes OverWriteMode=1 ; 0 to Disable ;---------------------------------------------------------------------------------------- ; Alter following Hotkey-Labels as required, and remove the semi-colon in the beginning ;#Q::Menu,Tray,Show,5,5 ; Shows the "Tray Menu" on TOP-LEFT of Screen ;#Z::Gosub,Exitt ; Exit this Script ;#F5::Reload ; Reload This Script #SingleInstance Ignore CoordMode, Menu, Screen CoordMode, Mouse, Screen OnExit, Exitt SetWorkingDir,%A_ScriptDir% IfNotExist,I_VIEW32.EXE ; IrfanView Executable { L1=IrfanView Executable I_VIEW32.EXE is required for functioning of L2=Script!..Download and install IrfanView and copy I_VIEW32.EXE to MsgBox,16,Missing File: %A_ScriptDir%\I_VIEW32.EXE,%L1%`n%L2%`n`n%A_ScriptDir%\ Errors=1 GoSub,Exitt } IFExist,Auto-WPC.GIF ; When a new version of the script is Installed { Runwait, i_view32.exe "Auto-WPC.GIF" /wall=1 /killmesoftly FileDelete,Auto-WPC.GIF WinMinimizeAll Sleep,5000 } IfnotExist,%ListFile% ; The Image Listing File { Errors=1 GoSub,CreateListFile } GoSub,CheckVariables SleepValue:=Duration EnvMult,SleepValue,(60*1000) ; Convert Duration into MilliSeconds Menu, Tray, NoStandard Menu, Tray, Add,&Open %ListFile% in Editor,EditListFile if OverWriteMode Menu, Tray, Add,&Create a New %ListFile%,CreateListFile else Menu, Tray, Add,&Add Images to %ListFile%,CreateListFile Menu, Tray, Add, ; ---------------------------------------------------------- if Play_A_Wave_Sound Menu, Tray, Add,Turn &Sound OFF ,ToggleSound else Menu, Tray, Add,Turn &Sound ON,ToggleSound If DisplayTooltip Menu, Tray, Add,Turn Tooltip &Display OFF,ToggleSound else Menu, Tray, Add,Turn Tooltip &Display ON ,ToggleSound Menu, Tray, Add, ; ---------------------------------------------------------- Menu, Tray, Add,&Visit the Webpage [www.geocities.com] ,OpenWebPage Menu, Tray, Add,e-Mail &Goyyah [arian.suresh@gmail.com],MailtoAuthor Menu, Tray, Add,Check for an &Update [%A_ScriptName%],CheckForUpdate Menu, Tray, Add,Fetch my &External IP Address,GetExternalIP Menu, Tray, Add, ; ---------------------------------------------------------- Menu, Tray, Add,Bac&kup a Copy of %A_ScriptName%,BackupScript Menu, Tray, Add,View &Readme.Txt,ViewReadme Menu, Tray, Add,E&xit Automatic Wallpaper Changer,Exitt Menu, Tray, Default,E&xit Automatic Wallpaper Changer Menu, Tray, Tip,Double-Click to Exit %A_ScriptName% ifExist,Auto-WPC.ICO Menu, Tray, Icon,Auto-WPC.ICO If PopupTrayMenu SetTimer, CheckMousePosition, 500 ; Read "ListFile" one line at a time, Check whether the file exists, and append ; it to a variable named "Flist" Flist:= FirstLine=1 FileCount=0 Loop, Read,%ListFile% { ImageFile=%A_LoopReadLine% ifexist,%ImageFile% FileCount+=1 if FirstLine=1 { Flist=%ImageFile% FirstLine=0 } else Flist=%Flist%`n%ImageFile% } FileDelete,RandList.txt If SetRandomWallPaper Sort,FLIST,Random FileAppend,%Flist%,RandList.Txt ; The Random list file is created If WallPaperOnExit= FileReadLine,WallPaperOnExit,RandList.TXT,1 ;---------------------------------------------------------------------------------------- ; // The Main Loop // ;---------------------------------------------------------------------------------------- LineNumber=1 Loop, { FileReadLine,ImageFileName,RandList.TXT,%LineNumber% if DisplayTooltip Tooltip, Changing Wallpaper to %ImageFileName%,30,30 if Play_A_Wave_Sound Soundplay,%WaveFileName% ; IrfanView Steps in Runwait, i_view32.exe "%ImageFileName%" /wall=%WallpaperSetType% /killmesoftly if DisplayTooltip { Sleep,%TooltipDisplayDuration% Tooltip } Sleep,%SleepValue% LineNumber+=1 If LineNumber > %FileCount% { if ! Repeatlist GoSub,Exitt else LineNumber=1 } } Return ;---------------------------------------------------------------------------------------- CheckVariables: ; and assign default values to erroneous values if Duration < .1 Duration=.1 if Duration > 60 Duration=60 If ListFile= ListFile=FileList.Txt if (WallPaperSetType !=0 and WallPaperSetType !=1 and WallPaperSetType !=2) WallpaperSetType=2 if (SetRandomWallpaper !=0 and SetRandomWallpaper !=1) SetRandomWallpaper=1 if (RepeatList !=0 and RepeatList !=1) RepeatList=1 if (PopupTrayMenu !=0 and PopupTrayMenu !=1) PopupTrayMenu=1 IFNotExist,%WallPaperOnExit% WallpaperOnExit= if (ChangeWallpaperOnExit !=0 and ChangeWallpaperOnExit !=1) ChangeWallpaperOnExit=1 if (DisplayTooltip !=0 and DisplayTooltip !=1) DisplayTooltip=1 if (DisplayTooltipDuration <500 and DisplayTooltipDuration >5000) DisplayTooltipDuration=2345 if DisplayTooltip EnvSub,SleepValue,%TooltipDisplayDuration% ; Adjusting Tooltip display if (RecurseSubFolders !=0 and RecurseSubFolders !=1) RecurseSubFolders=1 Return ;---------------------------------------------------------------------------------------- CreateListFile: WriteFile=%A_ScriptDir%\%ListFile% FileSelectFolder,ImageFolder,*%A_ScriptDir%,3,Select a Folder Containing Images if ImageFolder= ; The user pressed Escape in Select Folder Dialog if Errors Gosub,Exitt else reload StringRight,LastChar,ImageFolder,1 if LastChar != \ ImageFolder=%ImageFolder%\*.* else ImageFolder=%ImageFolder%*.* If OverWriteMode FileRecycle,%WriteFile% FirstLine=1 Loop,%ImageFolder%,0,%RecurseSubFolders% { ImageFile:=A_LoopFileLongPath SplitPath,ImageFile,,,ImageExt,, if ImageExt= Continue IfNotInString,ValidImageExtensions,%ImageExt% { Tooltip,Skipping: %ImageFile% Continue } FileGetSize,FileSize,%ImageFile%,K MinSize=Min%ImageExt%Size MinImageSize:=%MinSize% if FileSize < %MinImageSize% { Tooltip,Skipping: %ImageFile% Continue } Tooltip,Adding: %ImageFile% %FileSize% if FirstLine { FileAppend,%ImageFile%,%WriteFile% FirstLine=0 } else FileAppend,`n%ImageFile%,%WriteFile% Sleep,100 } reload Return ;---------------------------------------------------------------------------------------- EditListFile: ToolTip, RunWait,%ListFile% Return ;---------------------------------------------------------------------------------------- GetExternalIP: Tooltip,Resolving External IP Address,30,30 ExternalIP=0.0.0.0 TmpFile=IPAddress.TMP UrlDownloadToFile,http://www.whatismyip.org/,%TmpFile% FileReadLine,ExternalIP,%TmpFile%,1 FileDelete,%TmpFile% Tooltip, LastMenuItem = %A_ThisMenuItem% if LastMenuItem=Fetch my &External IP Address Msgbox,64,[Auto-WPC] External IP Address,External IP Address: %ExternalIP% Return ;---------------------------------------------------------------------------------------- OpenWebPage: URL=%WebLocation%index.htm GoSub,GetExternalIP if ExternalIP!=0.0.0.0 Run,%URL% Return ;---------------------------------------------------------------------------------------- MailtoAuthor: Run,mailto:arian.suresh@gmail.com?Subject=Re:Auto-WPC [%FileCreationTime%] Return ;---------------------------------------------------------------------------------------- CheckForUpdate: GoSub,GetExternalIP if ExternalIP=0.0.0.0 Exit DownloadFolder=%A_ScriptDir%\Download\ ifNotExist,%DownloadFolder% FileCreateDir,%DownloadFolder% FormatTime,TimeStamp,,[yy-MM-dd] @ [H.mm.ss] DownloadFileName=%DownloadFolder%%TimeStamp% - %A_ScriptName% URL=%WebLocation%\Auto-WPC.txt URLDownloadToFile,%URL%,%DownloadFileName% FileReadline,DL_Version,%DownloadFileName%,1 StringMid,DL_Version,DL_Version,18,14 if DL_Version > %FileCreationTime% { L1=The latest version of this script has been downloaded! L2=Would like to replace this Script with the new one? L3=Current %A_ScriptName% will be copied to BackUp\ folder. MsgBox,36,Automatic Wallpaper Changer - Internet Update ,%L1%`n%L2%`n`n%L3%`n`nProceed? ifMsgBox,Yes { inUpdationMode=1 GoSub,BackupScript FileCopy,%DownloadFileName%,%A_ScriptFullPath%,1 ; Overwrites Current Script! Readme=%A_ScriptDir%\Readme.txt ReadmeURL=%Weblocation%readme/%DL_Version%.txt URLDownloadToFile,%ReadmeURL%,%Readme% ImageURL=%Weblocation%splash.gif URLDownloadToFile,%ImageURL%,Auto-WPC.GIF Reload } } Return ;---------------------------------------------------------------------------------------- CheckMousePosition: ; When the Mouse is moved up to the TOP-LEFT corner, this routine Pop-up's the ; Tray Menu and minimizes all Visible Windows. Combined this with the Shift key ; Displays Tray Menu without Minimizing any Windows. Requires "PopupTrayMenu=1" MouseGetPos, Xpos, Ypos GetKeyState, ShiftStatus, Shift Pos:=Xpos+Ypos if Pos=0 { if ShiftStatus=U WinMinimizeAll Sleep,361 MouseGetPos, Xpos, Ypos Pos:=Xpos+Ypos if Pos=0 { MouseMove, 20, 20,5 Menu,Tray,Show,5,5 } } Return ;---------------------------------------------------------------------------------------- ToggleSound: ; and also Tooltip Display MenuItem:=A_ThisMenuItem if MenuItem=Turn &Sound ON { Play_A_Wave_Sound=1 Menu, Tray, Rename,Turn &Sound ON,Turn &Sound OFF } if MenuItem=Turn &Sound OFF { Play_A_Wave_Sound=0 Menu, Tray, Rename,Turn &Sound OFF,Turn &Sound ON } if MenuItem=Turn Tooltip &Display OFF { DisplayTooltip=0 Menu, Tray, Rename,Turn Tooltip &Display OFF,Turn Tooltip &Display ON EnvAdd,SleepValue,%TooltipDisplayDuration% ; Adjusting Tooltip display Time } if MenuItem=Turn Tooltip &Display ON { DisplayTooltip=1 Menu, Tray, Rename,Turn Tooltip &Display ON,Turn Tooltip &Display OFF EnvSub,SleepValue,%TooltipDisplayDuration% ; Adjusting Tooltip display Time } return ;---------------------------------------------------------------------------------------- BackupScript: BackupFolder=%A_ScriptDir%\Backup\ ifNotExist, %BackUpFolder% FileCreateDir,%BackupFolder% FormatTime,TimeStamp,,[yy-MM-dd] @ [H.mm.ss] BackupFileName=%BackUpFolder%%TimeStamp% - %A_ScriptName% FileCopy,%A_ScriptName%,%BAckupFileName% If ! inUpdationMode MsgBox,64,This Script [%A_ScriptName%] has been Archived,%BackupFileName%,10 Return ;---------------------------------------------------------------------------------------- ViewReadMe: Run,Readme.Txt return ;---------------------------------------------------------------------------------------- Exitt: if Errors Exitapp if ChangeWallpaperOnExit Run, i_view32.exe "%WallpaperOnExit%" /wall=%WallpaperSetType% /killmesoftly FileDelete,RandList.TXT ExitApp Return ;---------------------------------------------------------------------------------------- ;* - Script written by Goyyah [ arian.suresh@gmail.com ]