Jump to content

how to chance background


Recommended Posts

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]

Link to comment
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?

Link to comment
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)
Link to comment
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...

Link to comment
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?

Link to comment
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?

Link to comment
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
Edited by Authenticity
Link to comment
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 ?

Link to comment
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 ?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...