Sign in to follow this  
Followers 0
TheOnlyOne

how to chance background

26 posts in this topic

are there a script to chance the deskop background ?

Share this post


Link to post
Share on other sites



are there a script to chance the deskop background ?

Short answer -> check here.

Methodology:

You'll need to change the "Wallpaper" value in the registry under HKEY_CURRENT_USER\Control Panel\Desktop to update the path to the new image ("WallpaperStyle" changes stretch/center/tile option), then run:

RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

Happy scripting.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Short answer -> check here.

Methodology:

You'll need to change the "Wallpaper" value in the registry under HKEY_CURRENT_USER\Control Panel\Desktop to update the path to the new image ("WallpaperStyle" changes stretch/center/tile option), then run:

RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

Happy scripting.

hmm i seached now and i found this

Func _ChangeWallpaper($sFile,$iType)
; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2
  
  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf
  
  Select
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
  Case Else
  ;
  EndSelect
  
  RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
  DllCall("user32","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
  
  Return 0
EndFunc

but how do i chance what file i want to be at the background?

Share this post


Link to post
Share on other sites

If I understand you correctly then the first parameter $sFile should contain the full path string to the bitmap file with the extension .bmp or change it inside the function to filter also .jpg or .gif etc...

Share this post


Link to post
Share on other sites

@Authenticity

Example :

_ChangeWallPaper("yourfile.bmp", 1) ;dir with bmp name and titled to desktop

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@Authenticity

Example :

_ChangeWallPaper("yourfile.bmp", 1) ;dir with bmp name and titled to desktop

Cheers, FireFox.

tryed like you say

Func _ChangeWallPaper("C:\Documents and Settings\lo\Skrivebord\gaza_20090117_rafah.bmp", 1)

; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2
  
  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf
  
  Select
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')

  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
     
  Case Else
  ;
  EndSelect
  
  RegWrite('HKCU\Control Panel\Desktop','wallpaper','reg_sz',$sFile)
  DllCall("user32","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
  
  Return 0
EndFunc

but when i try to run it this error comes up

C:\Documents and Settings\lo\Skrivebord\oooo.au3(3,88) : ERROR: syntax error
Func _ChangeWallPaper("C:\Documents and Settings\lo\Skrivebord\gaza_20090117_rafah.bmp"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lo\Skrivebord\oooo.au3(16,27) : WARNING: $sFile: possibly used before declaration.
  If Not FileExists($sFile)
~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lo\Skrivebord\oooo.au3(26,15) : WARNING: $iType: possibly used before declaration.
  Case $iType =
~~~~~~~~~~~~~~^
C:\Documents and Settings\lo\Skrivebord\oooo.au3(16,27) : ERROR: $sFile: undeclared global variable.
  If Not FileExists($sFile)
~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lo\Skrivebord\oooo.au3 - 2 error(s), 2 warning(s)

Share this post


Link to post
Share on other sites

@TheOnlyOne

You have to call function with parameters so let function like it was when you found it and write my example before the function :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

you're declaring and calling the function at once ^^

it should be declared like this:

Func _ChangeWallPaper($sFile, $iType)

and called like this:

_ChangeWallPaper("C:\Test.bmp", 1)

don't forget that if the current working directory is already C: you can omit the C: and call it with the file name only...

Share this post


Link to post
Share on other sites

you're declaring and calling the function at once ^^

it should be declared like this:

Func _ChangeWallPaper($sFile, $iType)

and called like this:

_ChangeWallPaper("C:\Test.bmp", 1)

don't forget that if the current working directory is already C: you can omit the C: and call it with the file name only...

kk tryed that now i got it like this

Func _ChangeWallpaper($sFile,$iType)
; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2

  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf
  
  Select
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
  Case Else

  EndSelect

  RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
  DllCall("user32","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
       _ChangeWallpaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp",1)
  Return 0
EndFunc

but still it dont chance background?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

does the dll call at the end should be like that? I mean it supposed to be .dll or I'm wrong

Edit: oh sorry me clumsy =]

change DllCall("user32") to -> DllCall("User32.dll", ...)

Edited by Authenticity

Share this post


Link to post
Share on other sites

does the dll call at the end should be like that? I mean it supposed to be .dll or I'm wrong

Edit: oh sorry me clumsy =]

change DllCall("user32") to -> DllCall("User32.dll", ...)

now it like this

Func _ChangeWallpaper($sFile,$iType)
; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2

  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf
  
  Select
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
  Case Else

  EndSelect
 
  RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
  DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
   _ChangeWallpaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp",1)
  Return 0
EndFunc

but still dont work?

Share this post


Link to post
Share on other sites

@TheOnlyOne

Have you read my reply ?

_ChangeWallPaper("c:\...) has to be before the function, not in !

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

It's ok, everyone make mistakes sometimes

Here, this one should work ya:

_ChangeWallpaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp",1) ; only a simple cut & paste


Func _ChangeWallpaper($sFile,$iType)

; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2

  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf
  
  Select
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
  Case Else

  EndSelect

  RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
  DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
  Return 0
EndFunc
Edited by Authenticity

Share this post


Link to post
Share on other sites

@TheOnlyOne

Have you read my reply ?

_ChangeWallPaper("c:\...) has to be before the function, not in !

Cheers, FireFox.

like this ?

Func _ChangeWallpaper($sFile,$iType)

; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2

  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf

  Select
      
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
  Case Else

  EndSelect

_ChangeWallPaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp", 1)
  RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
  DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)

  Return 0
EndFunc

tryed other plases but dident work there ether ?

Share this post


Link to post
Share on other sites

@TheOnlyOne

:) I cant do anything for you...

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@TheOnlyOne

:) I cant do anything for you...

Cheers, FireFox.

to bad :/

Share this post


Link to post
Share on other sites

@TheOnlyOne

Example in #13 reply should work...

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

It's ok, everyone make mistakes sometimes

Here, this one should work ya:

_ChangeWallpaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp",1) ; only a simple cut & paste


Func _ChangeWallpaper($sFile,$iType)

; Changes the wallpaper to $sFilename using $iType as:
; 1 Tiled
; 2 Centered
; 3 Stretched
; any other value (usually 0) unchanged
;
; Returns
; 0 if everything is allright.
; -1 if $sFile does not exist. @error is set to 1
; -2 if £sFile is not a .bmp file. @error is set to 2

  If Not FileExists($sFile) Then
     SetError(1)
     Return -1
  EndIf
  If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
     SetError(2)
     Return -2
  EndIf
  
  Select
  Case $iType = 1
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 2
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
  Case $iType = 3
     RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
     RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
  Case Else

  EndSelect

  RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
  DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
  Return 0
EndFunc
thanks that works :)

but just got a other question hmm what is the @dir for a other drive then c:

for i wanna load from a other drive ?

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I wouldn't suggest doing this kind of thing, especially on slow machines because the viewer invoke it from different sectors and it can sometimes be a pain for the refresh rate or I'm just the only one who copying files from C:\* to D:\* is slow for ^^ anyway nothing special, just submit the full path to the D:\ path as it was with the C:\ path.

Edited by Authenticity

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

I wouldn't suggest doing this kind of thing, especially on slow machines because the viewer invoke it from different sectors and it can sometimes be a pain for the refresh rate or I'm just the only one who copying files from C:\* to D:\* is slow for ^^ anyway nothing special, just submit the full path to the D:\ path as it was with the C:\ path.

okay thanks

got a last question and dont know about its possible

but i want to chance the background on all computers on my school is that possible?

Edited by TheOnlyOne

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0