Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script themes change in XP at logon

Status
Not open for further replies.

bcastner

IS-IT--Management
Aug 13, 2002
29,271
US
I would appreciate looking at this XP Pro thread:
thread779-952393

Any help appreciated.

Best,
Bill Castner
 
Here is an example script that I created for a customer of mine that wanted to use the Desert Theme.

Code:
'==========================================================================
'
' VBScript Source File -- 
'
' NAME: desertTheme.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]

' DATE  : 04/22/2003
'
' COMMENT: 
'
' This script sets the desktop theme to "Desert"
'===========================================================================


on error resume next
Set WSHShell = Wscript.CreateObject("WScript.Shell")

path = "HKCU\Control Panel\Appearance\"

WSHShell.RegWrite path & "Current", "Desert","REG_SZ"
WSHShell.RegWrite path & "CustomColors", "FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,\FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,\FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,\FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00,FF,FF,FF,00","REG_BINARY"
  
path = "HKCU\Control Panel\Colors\" 
  
WSHShell.RegWrite path & "ActiveBorder","213 204 187", "REG_SZ"
WSHShell.RegWrite path & "ActiveTitle","0 128 128", "REG_SZ"
WSHShell.RegWrite path & "AppWorkSpace","162 141 104", "REG_SZ"
WSHShell.RegWrite path & "Background","162 141 104", "REG_SZ"
WSHShell.RegWrite path & "ButtonAlternateFace","192 192 192", "REG_SZ"
WSHShell.RegWrite path & "ButtonDkShadow","0 0 0", "REG_SZ"
WSHShell.RegWrite path & "ButtonFace","213 204 187", "REG_SZ"
WSHShell.RegWrite path & "ButtonHilight","234 230 221", "REG_SZ"
WSHShell.RegWrite path & "ButtonLight","213 204 187", "REG_SZ"
WSHShell.RegWrite path & "ButtonShadow","162 141 104", "REG_SZ"
WSHShell.RegWrite path & "GradientActiveTitle","132 189 170", "REG_SZ"
WSHShell.RegWrite path & "GradientInactiveTitle","232 208 128", "REG_SZ"
WSHShell.RegWrite path & "GrayText","162 141 104", "REG_SZ"
WSHShell.RegWrite path & "Hilight","0 128 128", "REG_SZ"
WSHShell.RegWrite path & "HotTrackingColor","0 128 128", "REG_SZ"
WSHShell.RegWrite path & "InactiveBorder","213 204 187", "REG_SZ"
WSHShell.RegWrite path & "InactiveTitle","162 141 104", "REG_SZ"
WSHShell.RegWrite path & "InactiveTitleText","255 255 255", "REG_SZ"
WSHShell.RegWrite path & "InfoWindow","255 255 255", "REG_SZ"
WSHShell.RegWrite path & "Menu","213 204 187", "REG_SZ"
WSHShell.RegWrite path & "Scrollbar","234 230 221", "REG_SZ"
  
 path= "HKCU\Control Panel\Desktop\WindowMetrics"
WSHShell.RegWrite path & "BorderWidth","-15","REG_SZ"
WSHShell.RegWrite path & "CaptionFont","F5,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,\BC,02,00,00,00,00,00,00,00,00,00,00,4D,00,69,00,\63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,\53,00,61,00,6E,00,73,00,20,00,53,00,65,00,72,00,\69,00,66,00,00,00,FC,7F,22,14,FC,7F,B0,FE,12,00,\00,00,00,00,00,00,00,00,98,23,EB,77", "REG_BINARY"
  
WSHShell.RegWrite path & "IconFont","F5,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,\90,01,00,00,00,00,00,00,00,00,00,00,4D,00,69,00,\63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,\53,00,61,00,6E,00,73,00,20,00,53,00,65,00,72,00,\69,00,66,00,00,00,14,00,0B,00,00,00,00,FF,12,00,\50,00,00,00,C0,FE,12,00,0C,10,00,01", "REG_BINARY"
  
WSHShell.RegWrite path & "IconSpacing","-1125", "REG_SZ"

WSHShell.RegWrite path & "MenuFont","F5,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,\90,01,00,00,00,00,00,00,00,00,00,00,4D,00,69,00,\63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,\53,00,61,00,6E,00,73,00,20,00,53,00,65,00,72,00,\69,00,66,00,00,00,14,00,88,FB,E8,77,02,02,00,00,\AC,B9,F0,77,00,00,00,00,20,00,00,00", "REG_BINARY"

WSHShell.RegWrite path & "MessageFont",_
"F5,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,\90,01,00,00,00,00,00,00,00,00,00,00,4D,00,69,00,\63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,\53,00,61,00,6E,00,73,00,20,00,53,00,65,00,72,00,\69,00,66,00,00,00,00,00,06,00,00,00,18,00,00,00,\FF,FF,FF,FF,F0,4B,21,FC,00,C4,F0,77", "REG_BINARY"

WSHShell.RegWrite path & "ScrollHeight","-195", "REG_SZ"
WSHShell.RegWrite path & "ScrollWidth","-195", "REG_SZ"
WSHShell.RegWrite path & "Shell Icon Size","32", "REG_SZ"
  
WSHShell.RegWrite path & "SmCaptionFont","F5,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,\90,01,00,00,00,00,00,00,00,00,00,00,4D,00,69,00,\63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,\53,00,61,00,6E,00,73,00,20,00,53,00,65,00,72,00,\69,00,66,00,00,00,F0,77,00,20,14,00,00,00,00,10,\80,05,14,00,F0,1F,14,00,00,00,14,00", "REG_BINARY"
WSHShell.RegWrite path & "SmCaptionHeight","-225","REG_SZ"
WSHShell.RegWrite path & "SmCaptionWidth","-225","REG_SZ"
  
WSHShell.RegWrite path & "StatusFont","F5,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,\BC,02,00,00,00,00,00,00,00,00,00,00,4D,00,69,00,\63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,\53,00,61,00,6E,00,73,00,20,00,53,00,65,00,72,00,\69,00,66,00,00,00,00,00,00,00,00,00,00,00,00,00,\00,00,00,00,7C,6B,E8,77,00,00,00,00", "REG_BINARY"
 
path= "HKCU\Control Panel\Desktop\"
WSHShell.RegWrite path & "Wallpaper","","REG_SZ"

path= "HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\"
WSHShell.RegWrite path & "GeneralFlags", "00000000", "REG_DWORD"
  
  
path="HKCU\Software\Microsoft\Internet Explorer\Desktop\General"
WSHShell.RegWrite path & "BackupWallpaper","","REG_SZ"
WSHShell.RegWrite path & "Wallpaper","","REG_SZ"
WSHShell.RegWrite path & "WallpaperFileTime","00,00,00,00,00,00,00,00", "REG_BINARY"
WSHShell.RegWrite path & "WallpaperLocalFileTime","00,28,A1,53,C5,FF,FF,FF", "REG_BINARY"

WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop\" &_
"Taskbar", "0C,00,00,00,08,00,00,00,02,00,00,00,00,00,00,00,\B0,E2,2B,D8,64,57,D0,11,A9,6E,00,C0,4F,D7,05,A2,\22,00,1C,00,0A,01,00,00,1A,00,00,00,01,00,00,00,\00,00,00,00,00,00,00,00,00,00,00,00,4C,00,00,00,\01,14,02,00,00,00,00,00,C0,00,00,00,00,00,00,46,\81,00,00,00,10,00,00,00,A0,D8,24,4A,17,C6,C2,01,\58,2F,F7,A2,AD,03,C3,01,28,A8,F5,A2,AD,03,C3,01,\00,10,00,00,00,00,00,00,01,00,00,00,00,00,00,00,\00,00,00,00,00,00,00,00,16,01,14,00,1F,50,E0,4F,\D0,20,EA,3A,69,10,A2,D8,08,00,2B,30,30,9D,19,00,\23,43,3A,5C,00,00,00,00,00,00,00,00,00,00,00,00,\00,00,00,00,00,31,84,2E,00,31,00,00,00,00,00,43,\2E,D8,AC,30,00,44,6F,63,75,6D,65,6E,74,73,20,61,\6E,64,20,53,65,74,74,69,6E,67,73,00,44,4F,43,55,\4D,45,7E,31,00,23,00,31,00,00,00,00,00,81,2E,3D,\88,10,00,6D,6D,61,63,6C,61,63,68,6C,61,6E,00,4D,\4D,41,43,4C,41,7E,31,00,28,00,31,00,00,00,00,00,\39,2E,92,41,12,00,41,70,70,6C,69,63,61,74,69,6F,\6E,20,44,61,74,61,00,41,50,50,4C,49,43,7E,31,00,\21,00,31,00,00,00,00,00,C5,22,9D,91,10,00,4D,69,\63,72,6F,73,6F,66,74,00,4D,49,43,52,4F,53,7E,31,\00,29,00,31,00,00,00,00,00,D3,22,32,A6,10,00,49,\6E,74,65,72,6E,65,74,20,45,78,70,6C,6F,72,65,72,\00,49,4E,54,45,52,4E,7E,31,00,24,00,31,00,00,00,\00,00,DB,22,76,BA,10,00,51,75,69,63,6B,20,4C,61,\75,6E,63,68,00,51,55,49,43,4B,4C,7E,31,00,00,00,\60,00,00,00,03,00,00,A0,58,00,00,00,00,00,00,00,\74,65,63,68,77,6B,73,33,00,00,00,00,00,00,00,00,\14,2F,08,05,5F,FE,C3,44,BF,E8,75,48,E6,C7,9E,32,\CA,EB,9B,A2,0C,2F,D7,11,A0,40,00,10,5A,CA,FE,5E,\14,2F,08,05,5F,FE,C3,44,BF,E8,75,48,E6,C7,9E,32,\CA,EB,9B,A2,0C,2F,D7,11,A0,40,00,10,5A,CA,FE,5E,\10,00,00,00,05,00,00,A0,1A,00,00,00,A6,00,00,00,\00,00,00,00,08,00,00,00,02,00,00,00,F4,01,00,00,\01,00,00,00,07,00,00,00,4E,00,00,00,02,00,00,00,\40,00,32,00,63,02,00,00,3B,2E,43,7A,20,00,4C,61,\75,6E,63,68,20,49,6E,74,65,72,6E,65,74,20,45,78,\70,6C,6F,72,65,72,20,42,72,6F,77,73,65,72,2E,6C,\6E,6B,00,4C,41,55,4E,43,48,7E,31,2E,4C,4E,4B,00,\00,00,00,00,00,00,44,00,00,00,03,00,00,00,36,00,\32,00,A1,08,00,00,34,2E,81,BB,21,00,4C,61,75,6E,\63,68,20,4F,75,74,6C,6F,6F,6B,20,45,78,70,72,65,\73,73,2E,6C,6E,6B,00,4C,41,55,4E,43,48,7E,32,2E,\4C,4E,4B,00,00,00,00,00,00,00,3E,00,00,00,04,00,\00,00,30,00,32,00,22,06,00,00,64,2E,AE,98,20,00,\50,72,69,6D,61,6C,73,63,72,69,70,74,20,32,2E,32,\2E,6C,6E,6B,00,50,52,49,4D,41,4C,7E,31,2E,4C,4E,\4B,00,00,00,00,00,00,00,46,00,00,00,05,00,00,00,\38,00,32,00,A2,02,00,00,90,2E,A5,01,20,00,53,68,\6F,72,74,63,75,74,20,74,6F,20,43,6F,6C,6F,72,50,\69,63,2E,65,78,65,2E,6C,6E,6B,00,53,48,4F,52,54,\43,7E,31,2E,4C,4E,4B,00,00,00,00,00,00,00,4C,00,\00,00,00,00,00,00,3D,00,32,00,68,00,00,00,90,2E,\40,02,20,00,53,68,6F,72,74,63,75,74,20,74,6F,20,\4D,69,63,72,6F,73,6F,66,74,20,4F,75,74,6C,6F,6F,\6B,2E,6C,6E,6B,00,53,48,4F,52,54,43,7E,33,2E,4C,\4E,4B,00,00,00,00,00,00,00,00,4C,00,00,00,06,00,\00,00,3D,00,32,00,68,00,00,00,90,2E,2C,02,20,00,\53,68,6F,72,74,63,75,74,20,74,6F,20,4D,79,20,4E,\65,74,77,6F,72,6B,20,50,6C,61,63,65,73,2E,6C,6E,\6B,00,53,48,4F,52,54,43,7E,32,2E,4C,4E,4B,00,00,\00,00,00,00,00,00,3A,00,00,00,01,00,00,00,2C,00,\32,00,4F,00,00,00,3B,2E,46,7A,20,00,53,68,6F,77,\20,44,65,73,6B,74,6F,70,2E,73,63,66,00,53,48,4F,\57,44,45,7E,31,2E,53,43,46,00,00,00,00,00,00,00,\29,01,00,00,E0,06,00,00,00,00,00,00,16,00,00,00,\00,00,00,00,00,00,00,00,16,00,00,00,00,00,00,00,\01,00,00,00,01,00,00,00,AA,4F,28,68,48,6A,D0,11,\8C,78,00,C0,4F,D9,18,B4,11,02,00,00,E0,04,00,00,\00,00,00,00,16,00,00,00,00,00,00,00,00,00,00,00,\16,00,00,00,00,00,00,00,01,00,00,00", "REG_BINARY"

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Hello markdmac,

I wonder and hesitate, for quite a long time, if I should point out once again, maybe the last time---as I remember I had done it reluctantly on some previous occasion(s) that .regwrite reg_binary format is limited to 4 bytes long, no longer. But, this fact does not diminish your good effort vested in accomplishing the main functionality---though I am not particularly enthusiastic.

regards - tsuji
 
Thanks Tsuji,

I value your input. Just curious, why would this work then?

I basically did a reg export and converted all of it to regwrite commands. Seems to work a charm at my customer location.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
markdmac,

It only "works" apparently only because...

[1] You put "on error resume next" up there. Otherwise, it will show you how misguided really are those lines with "REG_BINARY".

[2] The theme change can be done with much more surgical precision other than setting at the same time other irrelevant entries. I think one of the reg_sz (the line with "desert") will do it. And those binary entries actually have not changed at all preserving the already existing entries as the outcome.

Back to the functioning of regwrite reg_binary, your renderment contains multiple misunderstanding.

[a] The value (param-2) is a numeric of 4 bytes long (same as dword in win32) at most. It is an limitation of wshshell not reg_binary in general. For instance:
[tt]
wshshell.regwrite svaluename, &hf1f2f3f4, "REG_BINARY"
[/tt]
and you'll the setting for the corresponding value name being looked like F4 F3 F2 F1 in regedit, for instance, with the order being the way it is written to the registry.

If do write anything longer, it will raise a runtime error. The runtime is by-passed and salvaged the situation only because of the "on error resume next" directive. For example if you write 6 bytes to it, it will error out.
[tt]
wshshell.regwrite svaluename, &hf1f2f3f4f5f6, "REG_BINARY" '_wrong_ [red]for demo only[/red]
[/tt]
[c] The value (param-2) would _not_ take a string "F1, F2, F3 ..." at all. It will raise again a runtime error.

[d] The backslash "\" you get from reg export is the line-continuation symbol. It should not be taken out and it means nothing to the setting.

I think I have explained enough and you're capable of figuring it all out.

- tsuji
 
Further notes and corrections:

typo:
>>[d] The backslash "\" you get from reg export is the line-continuation symbol. It should [red]not[/red] be taken out and it means nothing to the setting.

Also I should have further expand on the .
[b bis] The runtime raised for the case if I put &hf1f2f3f4f5f6 may be due more to vbs engine than the wshshell.regwrite method.

[b.2] To demonstrate more properly the length limitation, suppose you have some arithmatic to make a numeric longer than 4 bytes, like this.
[tt]
wshshell.regwrite svaluename,&hffffffff+&heeeeeeee,"REG_BINARY" '_wrong_ [red]for demo only[/red]
[/tt]
This statement will _not_ raise a runtime error. But the result is "unexpected". It will write only 4 bytes to the registry (ED EE EE EE), a bad surprise. This is another facet, more generic, of the 4 bytes rule.

- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top