damian666 Posted July 11, 2007 Share Posted July 11, 2007 hi guys, as you see i am new here, and yes ofcourse i did search and saw a lot of scripts that changed wallpapers. but i want to do it on login or boot. so i took a script like that, commented all the gui pieces out of it and tyhen i wanted to have a textfile with the filenames, which it can choose on startup. and now the real question, how do i let my changer roulate throug the names so everytime there is a different wallpaper if i boot? i hope some body could help me with this. thanx in advance damian666 and proud of it!!! Link to comment Share on other sites More sharing options...
mrbond007 Posted July 11, 2007 Share Posted July 11, 2007 Radom() function ?? $1 = @MyDir & "\wallpaper1.jpg" $2 = @MyDir & "\wallpaper2.jpg" $3 = @MyDir & "\wallpaper3.jpg" $4 = @MyDir & "\wallpaper4.jpg" $randm = Random(1, 4, 1) If $randm = 1 Then ; Set wallpaper $1 ElseIf $random = 2 Then ; Set wallpaper $2 ElseIf $random = 3 Then ; Set wallpaper $3 ElseIf $random = 3 Then ; Set wallpaper $4 EndIf Projects : Space Regain - Memory Fusion - PWGT - Chip-ITGames : BrainPain - BrainPain Director's Cut - ProSpeed Games Pack (New)Vista vs XP : the forbidden fight Link to comment Share on other sites More sharing options...
MisterBates Posted July 11, 2007 Share Posted July 11, 2007 hi guys, as you see i am new here, and yes ofcourse i did search and saw a lot of scripts that changed wallpapers. but i want to do it on login or boot. so i took a script like that, commented all the gui pieces out of it and tyhen i wanted to have a textfile with the filenames, which it can choose on startup. and now the real question, how do i let my changer roulate throug the names so everytime there is a different wallpaper if i boot?#include <math.au3> $aFilenames = ['file1','file2'] $iWallpaper = random(0, ubound($aFilenames), 1) fileopen($aFilenames[$iWallpaper], 0) [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
SadBunny Posted July 11, 2007 Share Posted July 11, 2007 (edited) First: welcome to AutoIt! Second: well those two posts didn't exactly answer all your questions. What you could do is: 1) Compile the following code to an exe file (it is untested because I don't feel like rebooting several times, but should work provided I didn't forget something small). I commented it so you know what it is about. $curNr = RegRead("HKLM\Software\bgchanger","currentbackground"); <- read current bg nr from registry If RegRead("HKLM\Software\bgchanger","currentbackground") = "" Then; <- key didn't exist yet, create default RegWrite("HKLM\Software\bgchanger","currentbackground","REG_DWORD",1) $curNr = 1 EndIf Dim $dirInfo[1]; <- create array $dirInfo = DirGetSize("c:\backgrounds",1); <- put extended dir info in $dirInfo $maxNr = $dirInfo[1]; <- element 1 contains number of files in dir ( = max bg number) FileCopy("c:\backgrounds\"&$curNr&".jpg","c:\windows\background.jpg",1); <- copy new background picture to same background name, flag 1 is to overwrite existing file $curNr += 1 If $curNr > $maxNr Then $curNr = 1 RegWrite("HKLM\Software\bgchanger","currentbackground","REG_DWORD",$curNr); <- write new number to registry for use at next reboot Exit 2) Create a file c:\windows\background.jpg, and set windows to use that file as the background. 3) Make a folder called c:\backgrounds, and put all your backgrounds in there named 1.jpg, 2.jpg, 3.jpg .......... 4) Place the .exe file in the registry in HKLM\Software\Microsoft\Windows\CurrentVersion\Run. This will make it run at every boot. 5) Run the exe manually once. After following reboots, the background should keep changing I guess. Ofcourse you could expand this in many ways, but this should cover your basics. Again: note that my code is untested since I don't feel like rebooting. I think it should work though. /edit: also, just adding another background jpg file in c:\backgrounds will automatically work including it in the scheme, provided you ONLY have files called <number>.jpg in c:\backgrounds and all numbers are subsequently numbered and start with 1.jpg. Edited July 11, 2007 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
damian666 Posted July 13, 2007 Author Share Posted July 13, 2007 thanx guys, going to try those options... @sadbunny pm'ed you.. thanx damian666 and proud of it!!! Link to comment Share on other sites More sharing options...
damian666 Posted July 16, 2007 Author Share Posted July 16, 2007 well guys, it worked, many thanx espaccially you sad bunny! here is the script, it works now i only have to perfect it! expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.4.1 Author: Damian666 Script Function: change wallpaper on login #ce ---------------------------------------------------------------------------- ;unpack needed files FileInstall("tools\i_view32.exe", "i_view32.exe", 1) ; <- read current bg nr from registry $curNr = RegRead("HKLM\Software\bgchanger", "currentbackground") ; <- key didn't exist yet, create default If RegRead("HKLM\Software\bgchanger", "currentbackground") = "" Then RegWrite("HKLM\Software\bgchanger", "currentbackground", "REG_DWORD", 1) $curNr = 1 EndIf Dim $dirInfo[1]; <- create array $dirInfo = DirGetSize(@ScriptDir & "\wallpaper", 1); <- put extended dir info in $dirInfo $maxNr = $dirInfo[1]; <- element 1 contains number of files in dir ( = max bg number) FileCopy(@ScriptDir & "\wallpaper\" & $curNr & ".*", @ScriptDir, 1); <- copy new background picture to workingdir, flag 1 is to overwrite existing file $curNr += 1 If $curNr > $maxNr Then $curNr = 1 RegWrite("HKLM\Software\bgchanger", "currentbackground", "REG_DWORD", $curNr); <- write new number to registry for use at next reboot ;convert wallpaper to bmp RunWait(@ScriptDir & "\i_view32.exe *.jpg /convert=wallpaper.bmp", @ScriptDir, @SW_HIDE) FileDelete(@ScriptDir & "\*.jpg") ;write wallpaper style to register RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", "2") RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", "0") Sleep(250) ;apply wallpaper and refresh desktop DllCall("User32.dll", "int", "SystemParametersInfo", "int", 20, "int", 0, "string", @ScriptDir & "\wallpaper.bmp", "int", 0x01) FileDelete (@ScriptDir & "\i_view32.exe") Exit bye bbye damian666 and proud of it!!! Link to comment Share on other sites More sharing options...
SadBunny Posted July 16, 2007 Share Posted July 16, 2007 Glad to be of help. Good luck perfecting it! Btw, your little script looks very readable right now... Keep using empty lines, indentation and comments, also in bigger scripts, and you should be fine :-) Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
damian666 Posted July 16, 2007 Author Share Posted July 16, 2007 thank you so much, and see you around... Dutch = een fijne dag verder gozer = Dutch damian666 and proud of it!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now