Jump to content

Recommended Posts

Posted (edited)

im trying to make a program that will change my background when i press a set hotkey, and then be able to restore the old background settings when a different hot key is pressed.

 

 the issue is that the settings seem to change as regedit shows the key is changed but the background still does the same thing and nothing changes visually. 

 

code:

#include <GDIPlus.au3>
Global $key = "HKEY_CURRENT_USER\Control Panel\Desktop"
Global $inidir = @ScriptDir & "\Back.ini"
Global $test = 1

Global $background,$Black1key,$Black2key,$Black3key,$key,$Special1key,$Special2key,$Special3key, $CheckKey1, $CheckKey2, $CheckKey3

Global $SaveKey1 = RegRead($key, "TileWallPaper")
Global $SaveKey2 = RegRead($key, "WallpaperStyle")
Global $SaveKey3 = RegRead($key, "Wallpaper")

IniWrite($inidir, "Start", "TileWallPaper", $SaveKey1)
IniWrite($inidir, "Start", "WallpaperStyle", $SaveKey2)
IniWrite($inidir, "Start", "Wallpaper", $SaveKey3)

Global $exitkey = IniRead($inidir, "Config", "exitkey", "")
Global $Setblackkey = IniRead($inidir, "Config", "setblackkey", "")
Global $Setspecialkey = IniRead($inidir, "Config", "setspecialkey", "")
Global $Restorekey = IniRead($inidir, "Config", "restorekey", "")
Global $Checkkey = IniRead($inidir, "Config", "Checkkey", "")
    HotKeySet($exitkey,"Terminate")
    HotKeySet($Setblackkey,"setblack")
    HotKeySet($Setspecialkey,"setspecial")
    HotKeySet($Restorekey,"restore")
    If $test = 1 Then HotKeySet($Checkkey,"CheckKeys")

CheckKeys()

While 1
    Sleep(100)
WEnd

Func CheckKeys()
    RegRead($key, "TileWallPaper")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "TileWallPaper Key Does Not Exist")
        Return False
    EndIf
    RegRead($key, "WallpaperStyle")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "WallpaperStyle Key Does Not Exist")
        Return False
    EndIf
    RegRead($key, "Wallpaper")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "Wallpaper Key Does Not Exist")
        Return False
    EndIf
    $CheckKey1 = RegRead($key, "TileWallPaper")
    $CheckKey2 = RegRead($key, "WallpaperStyle")
    $CheckKey3 = RegRead($key, "Wallpaper")
        Sleep(10)
    $Special1key = IniRead($inidir, "Special", "TileWallPaper", "")
    $Special2key = IniRead($inidir, "Special", "WallpaperStyle", "")
    $Special3key = IniRead($inidir, "Special", "Wallpaper", "")
        Sleep(10)
    $Black1key = IniRead($inidir, "Black", "TileWallPaper", "")
    $Black2key = IniRead($inidir, "Black", "WallpaperStyle", "")
    $Black3key = IniRead($inidir, "Black", "Wallpaper", "")
        Sleep(10)
    if $test = 1 Then MsgBox(0,"Test","Keys Checked")
EndFunc

Func setblack()
    if $test = 1 Then MsgBox(0,"Test","Attempting to set background Black")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $Black1key)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $Black2key)
    RegWrite($key, "Wallpaper", "REG_SZ", $Black3key)
    if $test = 1 Then Test()
EndFunc

Func setspecial()
    if $test = 1 Then MsgBox(0,"Test","Attempting to set background to special mode")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $Special1key)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $Special2key)
    RegWrite($key, "Wallpaper", "REG_SZ", $Special3key)
    if $test = 1 Then Test()
EndFunc

Func restore()
    if $test = 1 Then MsgBox(0,"Test","Attempting to restore background")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $SaveKey1)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $SaveKey2)
    RegWrite($key, "Wallpaper", "REG_SZ", $SaveKey3)
    if $test = 1 Then Test()
EndFunc

Func Test()
    CheckKeys()
    if $CheckKey1 = $Special1key And $CheckKey2 = $Special2key And $CheckKey3 = $Special3key Then
        $background = "Special"
    ElseIf $CheckKey1 = $Black1key And $CheckKey2 = $Black2key And $CheckKey3 = $Black3key Then
        $background = "Black"
    Else
        $background = "Unknown"
    EndIf
     MsgBox(0,"Test","The background mode is: " & $background)
EndFunc

Func Terminate()
    Exit
EndFunc

 

ini:

[Config]
exitkey = ^!+{ESC}
setblackkey = ^!+1
setspecialkey = ^!+2
restorekey = ^!+5
Checkkey =  ^!+8

[Start]
TileWallPaper =0
WallpaperStyle =6
Wallpaper =C:\Users\Kid\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper

[Special]
TileWallPaper = 0
WallpaperStyle = 6
Wallpaper = C:\Users\Kid\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper

[Black]
TileWallPaper = 0
WallpaperStyle = 6
Wallpaper =

 

Edited by Golbez
Posted

You'd have to log off and log back onto Windows for the background change to take effect. The other way would be to kill the process explorer.exe, and then restart it. That might work correctly.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

soo something like 


If ProcessExists("explorer.exe") Then ProcessClose("explorer.exe") 

 

at the end of the background change?

 

 

seems as if i need to change it off slideshow mode also?

Edited by Golbez
Posted

You don't need the If ProcessExists, your Windows won't run properly if it's not running, just kill it, and the restart it with the Run statement.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

soo currently i have it killing the process after it sets the reg but it doesnt seem to work, is there a way to disable the slideshow mode via registry?

 

ive added a few more settings to read/write/delete that ive noticed when i switch settings

 

code:

#include <GDIPlus.au3>
Global $key = "HKEY_CURRENT_USER\Control Panel\Desktop"
Global $inidir = @ScriptDir & "\Back.ini"
Global $test = 1

Global $background,$Black1key,$Black2key,$Black3key,$key,$Special1key,$Special2key,$Special3key, $CheckKey1, $CheckKey2, $CheckKey3,$CheckKey4, $CheckKey5, $CheckKey6
Global $Special4key,$Special5key, $Special6key, $Black4key, $Black5key, $Black6key, $setblack

Global $SaveKey1 = RegRead($key, "TileWallPaper")
Global $SaveKey2 = RegRead($key, "WallpaperStyle")
Global $SaveKey3 = RegRead($key, "Wallpaper")
Global $SaveKey4 = RegRead($key, "TranscodedImageCache")
Global $SaveKey5 = RegRead($key, "TranscodedImageCache_000")
Global $SaveKey6 = RegRead($key, "TranscodedImageCache_001")

IniWrite($inidir, "Start", "TileWallPaper", $SaveKey1)
IniWrite($inidir, "Start", "WallpaperStyle", $SaveKey2)
IniWrite($inidir, "Start", "Wallpaper", $SaveKey3)
IniWrite($inidir,"Start","TranscodedImageCache", $SaveKey4)
IniWrite($inidir,"Start","TranscodedImageCache_000", $SaveKey5)
IniWrite($inidir,"Start","TranscodedImageCache_001", $SaveKey6)

Global $exitkey = IniRead($inidir, "Config", "exitkey", "")
Global $Setblackkey = IniRead($inidir, "Config", "setblackkey", "")
Global $Setspecialkey = IniRead($inidir, "Config", "setspecialkey", "")
Global $Restorekey = IniRead($inidir, "Config", "restorekey", "")
Global $Checkkey = IniRead($inidir, "Config", "Checkkey", "")
    HotKeySet($exitkey,"Terminate")
    HotKeySet($Setblackkey,"setblack")
    HotKeySet($Setspecialkey,"setspecial")
    HotKeySet($Restorekey,"restore")
    If $test = 1 Then HotKeySet($Checkkey,"CheckKeys")

CheckKeys()

While 1
    Sleep(100)
WEnd

Func CheckKeys()
    RegRead($key, "TileWallPaper")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "TileWallPaper Key Does Not Exist")
        Return False
    EndIf
    RegRead($key, "WallpaperStyle")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "WallpaperStyle Key Does Not Exist")
        Return False
    EndIf
    RegRead($key, "Wallpaper")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "Wallpaper Key Does Not Exist")
        Return False
    EndIf
    $CheckKey1 = RegRead($key, "TileWallPaper")
    $CheckKey2 = RegRead($key, "WallpaperStyle")
    $CheckKey3 = RegRead($key, "Wallpaper")
    $CheckKey4 = RegRead($key, "TranscodedImageCache")
        If @error Then $CheckKey4 = "null"
    $CheckKey5 = RegRead($key, "TranscodedImageCache_000")
        If @error Then $CheckKey5 = "null"
    $CheckKey6 = RegRead($key, "TranscodedImageCache_001")
        If @error Then $CheckKey6 = "null"
    $Special1key = IniRead($inidir, "Special", "TileWallPaper", "")
    $Special2key = IniRead($inidir, "Special", "WallpaperStyle", "")
    $Special3key = IniRead($inidir, "Special", "Wallpaper", "")
    $Special4key = IniRead($inidir, "Special", "TranscodedImageCache", "")
    $Special5key = IniRead($inidir, "Special", "TranscodedImageCache_000", "")
    $Special6key = IniRead($inidir, "Special", "TranscodedImageCache_001", "")
    $Black1key = IniRead($inidir, "Black", "TileWallPaper", "")
    $Black2key = IniRead($inidir, "Black", "WallpaperStyle", "")
    $Black3key = IniRead($inidir, "Black", "Wallpaper", "")
    $Black4key = IniRead($inidir, "Black", "TranscodedImageCache", "")
    $Black5key = IniRead($inidir, "Black", "TranscodedImageCache_000", "")
    $Black6key = IniRead($inidir, "Black", "TranscodedImageCache_001", "")

    if $CheckKey1 = $Special1key And $CheckKey2 = $Special2key And $CheckKey3 = $Special3key Then
        $background = "Special"
        $setblack = 0
    ElseIf $CheckKey1 = $Black1key And $CheckKey2 = $Black2key And $CheckKey3 = $Black3key Then
        $background = "Black"
        $setblack = 1
    Else
        $background = "Unknown"
    EndIf
    if $test = 1 Then MsgBox(0,"Test","Keys Checked")
EndFunc

Func setblack()
    $setblack = 1
    if $test = 1 Then MsgBox(0,"Test","Attempting to set background Black")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $Black1key)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $Black2key)
    RegWrite($key, "Wallpaper", "REG_SZ", $Black3key)
    RegWrite($key, "TranscodedImageCache", "REG_BINARY", $Black4key)
    RegDelete($key, "TranscodedImageCache_000")
    RegDelete($key, "TranscodedImageCache_001")
    ;RegWrite($key, "TranscodedImageCache_000", "REG_BINARY", $Black5key)
    ;RegWrite($key, "TranscodedImageCache_001", "REG_BINARY", $Black6key)
    if $test = 1 Then Test()
    ProcessClose("explorer.exe")
EndFunc

Func setspecial()
    $setblack = 0
    if $test = 1 Then MsgBox(0,"Test","Attempting to set background to special mode")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $Special1key)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $Special2key)
    RegWrite($key, "Wallpaper", "REG_SZ", $Special3key)
    RegWrite($key, "TranscodedImageCache", "REG_BINARY", $Special4key)
    RegWrite($key, "TranscodedImageCache_000", "REG_BINARY", $Special5key)
    RegWrite($key, "TranscodedImageCache_001", "REG_BINARY", $Special6key)
    if $test = 1 Then Test()
    ProcessClose("explorer.exe")
EndFunc

Func restore()
    if $test = 1 Then MsgBox(0,"Test","Attempting to restore background")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $SaveKey1)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $SaveKey2)
    RegWrite($key, "Wallpaper", "REG_SZ", $SaveKey3)
    RegWrite($key, "TranscodedImageCache", "REG_BINARY", $SaveKey4)
    if $setblack = 0 then
        RegWrite($key, "TranscodedImageCache_000", "REG_BINARY", $SaveKey5)
        RegWrite($key, "TranscodedImageCache_001", "REG_BINARY", $SaveKey6)
    ElseIf $setblack = 1 Then
        RegDelete($key, "TranscodedImageCache_000")
        RegDelete($key, "TranscodedImageCache_001")
    EndIf
    if $test = 1 Then Test()
    ProcessClose("explorer.exe")
EndFunc

Func Test()
    CheckKeys()
    if $CheckKey1 = $Special1key And $CheckKey2 = $Special2key And $CheckKey3 = $Special3key Then
        $background = "Special"
        $setblack = 0
    ElseIf $CheckKey1 = $Black1key And $CheckKey2 = $Black2key And $CheckKey3 = $Black3key Then
        $background = "Black"
        $setblack = 1
    Else
        $background = "Unknown"
    EndIf
     MsgBox(0,"Test","The background mode is: " & $background)
EndFunc

Func Terminate()
    Exit
EndFunc



ini:

[Config]
exitkey = ^!+{ESC}
setblackkey = ^!+1
setspecialkey = ^!+2
restorekey = ^!+5
Checkkey =  ^!+8

[Start]
TileWallPaper =0
WallpaperStyle =6
Wallpaper =C:\Users\Kid\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper
TranscodedImageCache=0x7AC301008E7F0D00380B0000600700008BB8C6A10C02CB0145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C004300720061007A0079005F00660075006E00670069002E006A007000670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
TranscodedImageCache_000=0x7AC301008E7F0D00380B0000600700008BB8C6A10C02CB0145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C004300720061007A0079005F00660075006E00670069002E006A00700067000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005C005C003F005C0044004900530050004C00410059002300560049005A0030003000370030002300350026003100630061006400650035003500320026003000260055004900440035003100380023007B00650036006600300037006200350066002D0065006500390037002D0034006100390030002D0062003000370036002D003300330066003500370062006600340065006100610037007D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
TranscodedImageCache_001=0x7AC30100D69C010020030000C201000000E2A4F63BF9CD0145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C0049004B0073004B006200700077002E006A007000670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005C005C003F005C0044004900530050004C0041005900230053005000540032003200300034002300350026003100630061006400650035003500320026003000260055004900440035003100320023007B00650036006600300037006200350066002D0065006500390037002D0034006100390030002D0062003000370036002D003300330066003500370062006600340065006100610037007D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[Special]
TileWallPaper = 0
WallpaperStyle = 6
Wallpaper = C:\Users\Kid\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper
TranscodedImageCache=0x7AC3010096490300000400000003000000A7DBE37312C60145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C00660069006E0061006C0037005F00320031005F0031003000320034002E006A007000670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
TranscodedImageCache_000=0x7AC3010096490300000400000003000000A7DBE37312C60145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C00660069006E0061006C0037005F00320031005F0031003000320034002E006A00700067000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005C005C003F005C0044004900530050004C00410059002300560049005A0030003000370030002300350026003100630061006400650035003500320026003000260055004900440035003100380023007B00650036006600300037006200350066002D0065006500390037002D0034006100390030002D0062003000370036002D003300330066003500370062006600340065006100610037007D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
TranscodedImageCache_001=0x7AC30100602A0200900600001A040000002EE0F13BF9CD0145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C0055006500550033004900410058002E006A007000670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005C005C003F005C0044004900530050004C0041005900230053005000540032003200300034002300350026003100630061006400650035003500320026003000260055004900440035003100320023007B00650036006600300037006200350066002D0065006500390037002D0034006100390030002D0062003000370036002D003300330066003500370062006600340065006100610037007D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[Black]
TileWallPaper = 0
WallpaperStyle = 6
Wallpaper =
TranscodedImageCache=0x7AC3010096490300000400000003000000A7DBE37312C60145003A005C004D007900200044006F00630075006D0065006E00740073005C00500069006300740075007200650073005C00570061006C006C00700061007000650072005C00660069006E0061006C0037005F00320031005F0031003000320034002E006A007000670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
TranscodedImageCache_000=null
TranscodedImageCache_001=null

 

edit:
seems to work if it is set to 1 picture, i guess i gotta figure out how to switch out of slideshow mode.

Edited by Golbez
Posted

You already know how to seting up the background. 

First of all do it one time then restart your computer. The purpose is to be sure your méthod is working. 

When this is ok, now just as @BrewManNH said. You need to refresh the screen to get it work.

Google it. 

Then code it. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted (edited)

1231.png.4fe60700805caf8f0cca51de4597e269.png 

 

the code works if i change it from slide show to picture or solid color, no restart is needed.

 

its something about it being in slideshow mode.

 

nvm i figured it out
https://superuser.com/questions/1007379/how-do-i-change-the-wallpaper-slideshow-album-programmatically

 

 

finnished code if anyone wants it:
 

#include <GDIPlus.au3>
#include <FileConstants.au3>
#include <WinAPIFiles.au3>
Global $key = "HKEY_CURRENT_USER\Control Panel\Desktop"
Global $copyfile = @ScriptDir & "\slideshow.ini"
Global $copydes = @AppDataDir & "\Microsoft\Windows\Themes\"
Global $inidir = @ScriptDir & "\Back.ini"
Global $test = IniRead($inidir, "Config", "test", "0")

Global $background,$Black1key,$Black2key,$Black3key,$key,$Special1key,$Special2key,$Special3key, $CheckKey1, $CheckKey2, $CheckKey3,$CheckKey4, $CheckKey5, $CheckKey6
Global $Special4key,$Special5key, $Special6key, $Black4key, $Black5key, $Black6key, $setblack

Global $SaveKey1 = RegRead($key, "TileWallPaper")
Global $SaveKey2 = RegRead($key, "WallpaperStyle")
Global $SaveKey3 = RegRead($key, "Wallpaper")
Global $SaveKey4 = RegRead($key, "TranscodedImageCache")
Global $SaveKey5 = RegRead($key, "TranscodedImageCache_000")
Global $SaveKey6 = RegRead($key, "TranscodedImageCache_001")

IniWrite($inidir, "Start", "TileWallPaper", $SaveKey1)
IniWrite($inidir, "Start", "WallpaperStyle", $SaveKey2)
IniWrite($inidir, "Start", "Wallpaper", $SaveKey3)
IniWrite($inidir,"Start","TranscodedImageCache", $SaveKey4)
IniWrite($inidir,"Start","TranscodedImageCache_000", $SaveKey5)
IniWrite($inidir,"Start","TranscodedImageCache_001", $SaveKey6)

Global $exitkey = IniRead($inidir, "Config", "exitkey", "")
Global $Setblackkey = IniRead($inidir, "Config", "setblackkey", "")
Global $Setspecialkey = IniRead($inidir, "Config", "setspecialkey", "")
Global $Restorekey = IniRead($inidir, "Config", "restorekey", "")
Global $Checkkey = IniRead($inidir, "Config", "Checkkey", "")
    HotKeySet($exitkey,"Terminate")
    HotKeySet($Setblackkey,"setblack")
    HotKeySet($Setspecialkey,"setspecial")
    HotKeySet($Restorekey,"restore")
    If $test = 1 Then HotKeySet($Checkkey,"CheckKeys")

CheckKeys()

While 1
    Sleep(100)
WEnd

Func CheckKeys()
    RegRead($key, "TileWallPaper")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "TileWallPaper Key Does Not Exist")
        Return False
    EndIf
    RegRead($key, "WallpaperStyle")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "WallpaperStyle Key Does Not Exist")
        Return False
    EndIf
    RegRead($key, "Wallpaper")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "Wallpaper Key Does Not Exist")
        Return False
    EndIf
    $CheckKey1 = RegRead($key, "TileWallPaper")
    $CheckKey2 = RegRead($key, "WallpaperStyle")
    $CheckKey3 = RegRead($key, "Wallpaper")
    $CheckKey4 = RegRead($key, "TranscodedImageCache")
        If @error Then $CheckKey4 = "null"
    $CheckKey5 = RegRead($key, "TranscodedImageCache_000")
        If @error Then $CheckKey5 = "null"
    $CheckKey6 = RegRead($key, "TranscodedImageCache_001")
        If @error Then $CheckKey6 = "null"
    $Special1key = IniRead($inidir, "Special", "TileWallPaper", "")
    $Special2key = IniRead($inidir, "Special", "WallpaperStyle", "")
    $Special3key = IniRead($inidir, "Special", "Wallpaper", "")
    $Special4key = IniRead($inidir, "Special", "TranscodedImageCache", "")
    $Special5key = IniRead($inidir, "Special", "TranscodedImageCache_000", "")
    $Special6key = IniRead($inidir, "Special", "TranscodedImageCache_001", "")
    $Black1key = IniRead($inidir, "Black", "TileWallPaper", "")
    $Black2key = IniRead($inidir, "Black", "WallpaperStyle", "")
    $Black3key = IniRead($inidir, "Black", "Wallpaper", "")
    $Black4key = IniRead($inidir, "Black", "TranscodedImageCache", "")
    $Black5key = IniRead($inidir, "Black", "TranscodedImageCache_000", "")
    $Black6key = IniRead($inidir, "Black", "TranscodedImageCache_001", "")

    if $CheckKey1 = $Special1key And $CheckKey2 = $Special2key And $CheckKey3 = $Special3key Then
        $background = "Special"
        $setblack = 0
    ElseIf $CheckKey1 = $Black1key And $CheckKey2 = $Black2key And $CheckKey3 = $Black3key Then
        $background = "Black"
        $setblack = 1
    Else
        $background = "Unknown"
    EndIf
    if $test = 1 Then MsgBox(0,"Test","Keys Checked")
EndFunc

Func setblack()
    $setblack = 1
    if $test = 1 Then MsgBox(0,"Test","Attempting to set background Black")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $Black1key)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $Black2key)
    RegWrite($key, "Wallpaper", "REG_SZ", $Black3key)
    RegWrite($key, "TranscodedImageCache", "REG_BINARY", $Black4key)
    RegDelete($key, "TranscodedImageCache_000")
    RegDelete($key, "TranscodedImageCache_001")
    If FileExists ($copydes & "slideshow.ini") Then
        FileDelete($copydes & "slideshow.ini")
        If $test = 1 then  MsgBox(0,"Test","Deleted slideshow.ini")
    EndIf
    if $test = 1 Then Test()
    ProcessClose("explorer.exe")
EndFunc

Func setspecial()
    $setblack = 0
    if $test = 1 Then MsgBox(0,"Test","Attempting to set background to special mode")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $Special1key)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $Special2key)
    RegWrite($key, "Wallpaper", "REG_SZ", $Special3key)
    RegWrite($key, "TranscodedImageCache", "REG_BINARY", $Special4key)
    RegWrite($key, "TranscodedImageCache_000", "REG_BINARY", $Special5key)
    RegWrite($key, "TranscodedImageCache_001", "REG_BINARY", $Special6key)
    FileCopy($copyfile, $copydes, $FC_OVERWRITE + $FC_CREATEPATH)
    if $test = 1 Then Test()
    ProcessClose("explorer.exe")
EndFunc

Func restore()
    if $test = 1 Then MsgBox(0,"Test","Attempting to restore background")
    CheckKeys()
    RegWrite($key, "TileWallPaper", "REG_SZ", $SaveKey1)
    RegWrite($key, "WallpaperStyle", "REG_SZ", $SaveKey2)
    RegWrite($key, "Wallpaper", "REG_SZ", $SaveKey3)
    RegWrite($key, "TranscodedImageCache", "REG_BINARY", $SaveKey4)
    if $setblack = 0 then
        RegWrite($key, "TranscodedImageCache_000", "REG_BINARY", $SaveKey5)
        RegWrite($key, "TranscodedImageCache_001", "REG_BINARY", $SaveKey6)
        FileCopy($copyfile, $copydes, $FC_OVERWRITE + $FC_CREATEPATH)
    ElseIf $setblack = 1 Then
        RegDelete($key, "TranscodedImageCache_000")
        RegDelete($key, "TranscodedImageCache_001")
        If FileExists ($copydes & "slideshow.ini") Then
            FileDelete($copydes & "slideshow.ini")
            If $test = 1 then  MsgBox(0,"Test","Deleted slideshow.ini")
        EndIf
    EndIf
    if $test = 1 Then Test()
    ProcessClose("explorer.exe")
EndFunc

Func Test()
    CheckKeys()
    if $CheckKey1 = $Special1key And $CheckKey2 = $Special2key And $CheckKey3 = $Special3key Then
        $background = "Special"
        $setblack = 0
    ElseIf $CheckKey1 = $Black1key And $CheckKey2 = $Black2key And $CheckKey3 = $Black3key Then
        $background = "Black"
        $setblack = 1
    Else
        $background = "Unknown"
    EndIf
     MsgBox(0,"Test","The background mode is: " & $background)
EndFunc

Func Terminate()
    Exit
EndFunc

 

Edited by Golbez

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
  • Recently Browsing   0 members

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