Draygoes Posted October 9, 2007 Posted October 9, 2007 Does anybody know a simple code to change the desktop wallpaper? If so, please post it here. thx Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.
BrettF Posted October 9, 2007 Posted October 9, 2007 (edited) _ChangeWallpaper made by DaProgramerYou will need Au3Lib for this to work.#Include <A3LGDIPlus.au3> Func _ChangeWallpaper($currentfile) RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0') RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2') $x = 0 While $x = 0 $CurrentFile = RotateFiles() If StringRight($CurrentFile,3) = "jpg" Or StringRight($CurrentFile,3) = "bmp" Then $x = 1 WEnd If StringRight($CurrentFile,3) = "jpg" Then _GDIP_StartUp() $hImage = _GDIP_ImageLoadFromFile($CurrentFile) $sCLSID = _GDIP_EncodersGetCLSID("BMP") _GDIP_ImageSaveToFileEx($hImage, @TempDir & "\999.bmp", $sCLSID) _GDIP_ShutDown() $CurrentFile = @TempDir & "\999.bmp" EndIf ;~ Sleep(500) RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $CurrentFile) DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $CurrentFile, "int", 0) EndFunc ;==>_ChangeWallpaperEDIT: Also have a look at Wallpaper Rotater by Piano_Man Edited October 9, 2007 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Draygoes Posted October 9, 2007 Author Posted October 9, 2007 (edited) Cool!!! Thx man!!! One problem. When I use it, I get this error: --------------------------- AutoIt Error --------------------------- Line 41 (File "C:\Users\Draygoes\Desktop\AutoItLib.au3"): Func _API_MultiByteToWideChar($sText, $iCodePage=0, $iFlags=0) Error: Duplicate function name. --------------------------- OK --------------------------- Am I using the function wrong? My code: #Include <A3LGDIPlus.au3> #include 'AutoItLib.au3' _ChangeWallpaper("C:\Users\Draygoes\Desktop\custom wallpapers\Comp-14.jpg") Func _ChangeWallpaper($currentfile) RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0') RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2') $x = 0 While $x = 0 $CurrentFile = RotateFiles() If StringRight($CurrentFile,3) = "jpg" Or StringRight($CurrentFile,3) = "bmp" Then $x = 1 WEnd If StringRight($CurrentFile,3) = "jpg" Then _GDIP_StartUp() $hImage = _GDIP_ImageLoadFromFile($CurrentFile) $sCLSID = _GDIP_EncodersGetCLSID("BMP") _GDIP_ImageSaveToFileEx($hImage, @TempDir & "\999.bmp", $sCLSID) _GDIP_ShutDown() $CurrentFile = @TempDir & "\999.bmp" EndIf ;~ Sleep(500) RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $CurrentFile) DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $CurrentFile, "int", 0) EndFunc;==>_ChangeWallpaper Edited October 9, 2007 by draygoes Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.
BrettF Posted October 9, 2007 Posted October 9, 2007 What happens if you remove line 2 in your example? (#include 'AutoItLib.au3') Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Draygoes Posted October 9, 2007 Author Posted October 9, 2007 I get this error: --------------------------- AutoIt Error --------------------------- Line 12 (File "C:\Users\Draygoes\Desktop\wallpaper.au3"): $CurrentFile = RotateFiles() $CurrentFile = ^ ERROR Error: Unknown function name. --------------------------- OK --------------------------- Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.
BrettF Posted October 9, 2007 Posted October 9, 2007 Oh sorry... Needed to remove a bit, since I directly leeched the function out of one of DaProgramer's programs. #Include <A3LGDIPlus.au3> _ChangeWallpaper("C:\Users\Draygoes\Desktop\custom wallpapers\Comp-14.jpg") Func _ChangeWallpaper($currentfile) RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0') RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2') If StringRight($CurrentFile,3) = "jpg" Then _GDIP_StartUp() $hImage = _GDIP_ImageLoadFromFile($CurrentFile) $sCLSID = _GDIP_EncodersGetCLSID("BMP") _GDIP_ImageSaveToFileEx($hImage, @TempDir & "\999.bmp", $sCLSID) _GDIP_ShutDown() $CurrentFile = @TempDir & "\999.bmp" EndIf ;~ Sleep(500) RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $CurrentFile) DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $CurrentFile, "int", 0) EndFunc;==>_ChangeWallpaper Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Draygoes Posted October 9, 2007 Author Posted October 9, 2007 Works now. Thanks! Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.
BrettF Posted October 9, 2007 Posted October 9, 2007 Thats ok Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Tripredacus Posted October 9, 2007 Posted October 9, 2007 That seems so unsimple! I use this one too! ; copy files to destination FileCopy ( "\\server\Install\LOGO's\client\MEGA95.BMP" , "C:\Windows" ) ; set background image RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","Wallpaper","REG_SZ","C:\Windows\MEGA95.BMP") Of course this is from an app that installs fonts, changes the screensaver, and changes the windows theme as well. Twitter | MSFN | VGCollect
BrettF Posted October 9, 2007 Posted October 9, 2007 That seems so unsimple! I use this one too! ; copy files to destination FileCopy ( "\\server\Install\LOGO's\client\MEGA95.BMP" , "C:\Windows" ) ; set background image RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","Wallpaper","REG_SZ","C:\Windows\MEGA95.BMP") Of course this is from an app that installs fonts, changes the screensaver, and changes the windows theme as well. My version converts .jpg to bitmaps... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
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