Sign in to follow this  
Followers 0
igmeou

Change Desktop Wallpaper

15 posts in this topic

Does anyone know how can I get AutoIt to change my desktop wallpaper in every minute?


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites



Info: I'm now using WinXP home SP2 and using an active desktop wallpaper

I found my wallpaper settings at HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper :)

Currently, I'm scripting my wallpaper(html). I need it to refresh after I had done some editing. :D

But currently the only way I know how to refresh the desktop is go Display Properties > Desktop click here and there then apply to refresh. :(

I had tried changing the registry key but it does not refresh the wallpaper. I think i must had miss out something. :D

Is there a better way to use autoIt script to help me refresh a active desktop wallpaper? :huh:


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ezzetabi looked at the active desktop wallpaper. This is one of his last attempts.

It takes more then just a registry key change to alter.

Have a look for yourself here.

Edited by MHz

Share this post


Link to post
Share on other sites

Thanks for the advice. It works!


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Yes. By restarting the explorer.exe it works but sometimes gives me the error for me to click a button to reactivate the active desktop... :huh:

I think that is not the ideal way but thats what I had for now. Still trying to digest the code by ezzetabi given the link by MHz. :D

Ok. After reading ezzetabi code. Can someone explain what this code do with the $sFile? Is it that by calling the dll it will update a pre-user define .ini file?

DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $sFile, "int", 0)

From msdn:

fWinIni

If a system parameter is being set, specifies whether the user profile is to be updated, and if so, whether the WM_SETTINGCHANGE message is to be broadcast to all top-level windows to notify them of the change. This parameter can be zero or can be one of the following values:

SPIF_UPDATEINIFILE

Writes the new system-wide parameter setting to the user profile.

SPIF_SENDCHANGE

Broadcasts the WM_SETTINGCHANGE message after updating the user profile.

SPIF_SENDWININICHANGE

Same as SPIF_SENDCHANGE.

Still don't fully understand what it meant. :D

Can someone illustrate better? :)

Edited by igmeou

[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

This is how you would use ezzetabi's code.

The DllCall makes the change happen.

; Example usage.

_ChangeWallpaper('C:\WINDOWS\Web\Wallpaper\Bliss.bmp', 3)


; The BMP Wallpaperchanger Function below.
; $sFile is the address of the bmp picture to use.
; $iType is setting for the wallpaper. (stretched, etc)

Func _ChangeWallpaper($sFile, $iType)
    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

Share this post


Link to post
Share on other sites

Ok. Thanks MHz. I had done some testing with your example.

The example work well when I'm using a bitmap as my wallpaper. :(

But current I'm using an active desktop which is a html file as my wallpaper. And with this wallpaper set, I tried using your example but nothing happen on the screen but the registry is being edited. :huh:

Next, I thought that it might be due to active desktop should used a different key to reactivate. So I modify your example to this for a test but unfortunately it failed. :)

Dim $keyname = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General"
Dim $valueName = "Wallpaper"
Dim $type = "REG_EXPAND_SZ"
Dim $value = "%ALLUSERSPROFILE%\Documents\MyDesktop\myDesktop.html"

;RegWrite ( "keyname" [,"valuename", "type", value] )
RegWrite($keyname, $valueName, $type, $value)

RegWrite($keyname, 'TileWallpaper', 'reg_sz', '0')
RegWrite($keyname, 'WallpaperStyle', 'reg_sz', '2')

DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $value, "int", 0)

It only work after I restart the explorer with the following code but as what I had mention eariler, it give me error sometimes. :D

ProcessClose ( "explorer.exe" )
If ProcessExists ( "explorer.exe" ) Then
    ProcessWaitClose ( "explorer.exe" )
Else
    Run("explorer.exe")
EndIf

Anyone had any idea what might go wrong? :D


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

I dunno about Win2k, NT, or XP, but on WinME(and 98 i think) if you right click on the desktop, one of the options is 'Refresh' and that'll, well, refresh your active desktop. I'm not sure what the code would be to implement that tho.


Moooo...

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Yes, I have just noticed it now. I am running XP SP2 and I have a 'refresh' aswell :).

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

I dunno about Win2k, NT, or XP, but on WinME(and 98 i think) if you right click on the desktop, one of the options is 'Refresh' and that'll, well, refresh your active desktop. I'm not sure what the code would be to implement that tho.

Yap, I knew that I had this function. Anyway, you can simply pressed F5 key instead of doing the right click, they work the same. :(

Ok now, the problem faced when using this function to is that I had to do the following settings in WinXP (Display Properties > Desktop > Customize Desktop > Web > New... > choose my file) And with this setting on, it set your desktop to something similar to a wepage and the problem lay here. :D

I lost my right click menu as the standard desktop right click has things like sent to etc... With this my right click menu had turn into the normal right click menu of what a normal brower would have. And if I would like the right click menu of both worlds, I set it to the "split desktop with icon" mode as shown in the attachment and this give me another problem as I have to recode my html page to suit this setting. :(

The previous post my setting is as follow (Display Properties > Browse > choose my file). I did my html code in this setting and everything work fine except that if I need to replace/refresh the wallpaper. Replace is only possible if I go through the steps that I did the settings(this is also the same with both the setting) and Refresh will only refresh the desktop and not the webpage set as my wallpaper with the amended code. Meaning, it is only refreshing the webpage that I had previously set and not the amended one. :D

Excuse me for writing such a long essay, but I'm just trying to make my problem to all as clear as possible. I think it should be the same for everyone as I had just formatted my system. :)

Can someone advice? :huh:


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

dude/(ette?)...ya lost me...however, if you would like to rotate your desktop every time you login/reboot, at http://www.shellcity.com there's a util called 'autowall' . I kno it works on WinME, but-not having access to one-I dunno if it works on the NT structure...I hope that helps some(cuz other than that, I'm too much of a noob at AutoIt to help with the coding-yet)


Moooo...

Share this post


Link to post
Share on other sites

Thanks Vu1kan. But I preper to get this opportunity to learn more on autoIt, and to write my own code for it. I know that there are quite a bunch of software out there that can do these but I just wish to know how the details of doing it myself. But now I'm stuck with this situation and I can't find much help in the internet too, so I would hope that someone in this forum would know how.


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

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