Jump to content

How to switch windows themes? (W7/x64)


iXX
 Share

Recommended Posts

Link to comment
Share on other sites

  • Moderators

Hi, iXX. You used to be able to do it all command-line in XP, but it is a bit more difficult in Win7. If you can put up with the control panel flashing briefly, this works:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <RecFileListToArray.au3>
#include <WindowsConstants.au3>

$aArray = _RecFileListToArray(@WindowsDir & "ResourcesThemes", "*.theme", 1)

Local $msg
$myGui = GUICreate("Change My Theme", 300, 300)
$listview = GUICtrlCreateListView("listview items", 10, 10, 280, 240)
_GUICtrlListView_SetColumn($listview, 0, "", 230, 0)
$go = GUICtrlCreateButton("Change Theme", 10, 260, 100, 35)
$exit = GUICtrlCreateButton("Exit", 190, 260, 100, 35)
 
For $i = 1 To UBound($aArray) - 1
GUICtrlCreateListViewItem($aArray[$i], $listview)
Next
 
GUISetState(@SW_SHOW)
 
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
Case $msg = $exit
    ExitLoop
Case $msg = $go
    $var = _GUICtrlListView_GetItemTextString($listview, -1)
    _change($var)
    WinClose("Control Panel")
    ExitLoop
EndSelect
WEnd
 
Func _change($var)
ShellExecute("desk.cpl", 'desk,@Themes /Action:OpenTheme /file:"C:windowsResourcesThemes' & $var & '"')
Send("{ENTER}")
Sleep(1000)
EndFunc
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Maybe I found a simplest way:

Let say I want to change current theme, located in "C:\Users\USER\AppData\Local\Microsoft\Windows\Themes\A.theme" to theme "C:\Users\USER\AppData\Local\Microsoft\Windows\Themes\B.theme".

I found if I double click to this "B.theme" file with my filemanager, windows theme changes immedially, control panel dont appears, it just say "Wait please" while changing... I cant found associated program in windows file associations dialog, so I search in the registry and found this:

[HKEY_CLASSES_ROOT\themefile\shell\open\command]

@=%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:"%1"

Teoreticaly, this should be working:

Run("%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:" "C:\Users\USER\AppData\Local\Microsoft\Windows\Themes\B.theme")

But it dont work.

Any ideas?

Link to comment
Share on other sites

... Found syntax error, now it is working, but the window "Individual settings" really did appears...

If someone solve flashing of this window, will be great!

RunWait(@ComSpec & " /c " & '%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:"C:\Users\USER\AppData\Local\Microsoft\Windows\Themes\B.theme"', "", @SW_HIDE)
WinWait("Individual settings")
WinClose("Individual settings")
Link to comment
Share on other sites

  • 7 months later...

iXX, everything works, but I had to change "Individual settings" to "Personalization", which is the window name. So I have to ask - was "Individual settings" changed to "Personalization" in Service Pack 1 or something? Where is that "Individual Settings" window? I'm asking because I want to ensure the best compatibility of my script.

Edited by supraspecies
Link to comment
Share on other sites

It might be a long time waiting for an answer from iXX, he hasn't been on the forum since last October.

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

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...