Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download - Clean, repair and optimize your system



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Code to toggle 2 themes

microsoft.public.windows.vista.general




Recommended Fix - Fix Vista Errors and Optimize Performance

Click On Your Flag for Translation
Simplified Chinese French Spanish Italian Portugeuse Japanese German Dutch
Driver Scanner 2009 - Free Scan Now
Reply
  #1 (permalink)  
Old 06-18-2009
Eustace
 

Posts: n/a
Code to toggle 2 themes
A nice guy once provided me the following code that toggles 2 Windows XP
themes:

============================================

Set WshShell = WScript.CreateObject("WScript.shell")

Theme1="C:\My Stuff\My Files\My Themes\My Vista Theme.theme"
Theme2="C:\My Stuff\My Files\My Themes\My Dark Theme.theme"

'Theme names
Themename1=mid(Theme1,instrrev(Theme1,"\")+1)
Themename2=mid(Theme2,instrrev(Theme2,"\")+1)

'Check current theme
on error resume next
themekey = "HKEY_CURRENT_USER\Software\Microsoft\Plus!\Themes \Current\"
CurrentTheme = wshshell.regread(themekey)
Currentthemename=mid(CurrentTheme,instrrev(Current Theme,"\")+1)
on error goto 0

'Choose theme to apply
If trim(lcase(currentthemename))=trim(lcase(Themename 1)) then
Theme=theme2
thememessage = left(Themename2,instrrev(Themename2,".")-1)
else
Theme=theme1
thememessage = left(Themename1,instrrev(Themename1,".")-1)
end if

'Apply the theme
runstring = chr(34) & Theme & chr(34)
WshShell.Run runstring

'Activate the window
counter = 600
activated = false
do
activated = WshShell.AppActivate("Display Properties")
wscript.sleep 100
counter = counter - 1
if counter = 0 then
wscript.quit
end if
loop until activated = true

wshshell.sendkeys "{ENTER}"

============================================

I had put it in a file and had a shortcut to it in the Quick Launch, so
I could easily change between these 2 themes. You see, I prefer white
text on dark background, and some application dialogs do not specify
both colors...

I tried to run the above code in Vista, but unfortunately, though it
does bring up the themes dialog, it does not change the themes
automatically.

How can I make it change the themes automatically in Vista?

Thanks,

emf

--
It ain't THAT, babe! - A radical reinterpretation
http://www.geocities.com/itaintme_babe/itaintme.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-18-2009
Jon
 

Posts: n/a
Re: Code to toggle 2 themes
Hi Eustace

Try using the line

activated = WshShell.AppActivate("Theme Settings")

in place of the current line

activated = WshShell.AppActivate("Display Properties")

The title / caption of the themes dialog has changed with Vista, hence the
need for the change.

--
Jon



"Eustace" <emfril@gmail.com> wrote in message
news:uw2lWO$7JHA.1712@TK2MSFTNGP03.phx.gbl...
>A nice guy once provided me the following code that toggles 2 Windows XP
>themes:
>
> ============================================
>
> Set WshShell = WScript.CreateObject("WScript.shell")
>
> Theme1="C:\My Stuff\My Files\My Themes\My Vista Theme.theme"
> Theme2="C:\My Stuff\My Files\My Themes\My Dark Theme.theme"
>
> 'Theme names
> Themename1=mid(Theme1,instrrev(Theme1,"\")+1)
> Themename2=mid(Theme2,instrrev(Theme2,"\")+1)
>
> 'Check current theme
> on error resume next
> themekey = "HKEY_CURRENT_USER\Software\Microsoft\Plus!\Themes \Current\"
> CurrentTheme = wshshell.regread(themekey)
> Currentthemename=mid(CurrentTheme,instrrev(Current Theme,"\")+1)
> on error goto 0
>
> 'Choose theme to apply
> If trim(lcase(currentthemename))=trim(lcase(Themename 1)) then
> Theme=theme2
> thememessage = left(Themename2,instrrev(Themename2,".")-1)
> else
> Theme=theme1
> thememessage = left(Themename1,instrrev(Themename1,".")-1)
> end if
>
> 'Apply the theme
> runstring = chr(34) & Theme & chr(34)
> WshShell.Run runstring
>
> 'Activate the window
> counter = 600
> activated = false
> do
> activated = WshShell.AppActivate("Display Properties")
> wscript.sleep 100
> counter = counter - 1
> if counter = 0 then
> wscript.quit
> end if
> loop until activated = true
>
> wshshell.sendkeys "{ENTER}"
>
> ============================================
>
> I had put it in a file and had a shortcut to it in the Quick Launch, so I
> could easily change between these 2 themes. You see, I prefer white text
> on dark background, and some application dialogs do not specify both
> colors...
>
> I tried to run the above code in Vista, but unfortunately, though it does
> bring up the themes dialog, it does not change the themes automatically.
>
> How can I make it change the themes automatically in Vista?
>
> Thanks,
>
> emf
>
> --
> It ain't THAT, babe! - A radical reinterpretation
> http://www.geocities.com/itaintme_babe/itaintme.html


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle Aero? Cat microsoft.public.windows.vista.general 8 04-24-2008 03:20
Fn + F5 Key for toggle between monitors Ravi Khurana microsoft.public.windows.vista.general 2 03-16-2008 19:35
Toggle Keys won't stay on? Victor Delta microsoft.public.windows.vista.general 10 01-16-2008 14:23
Toggle Problems Work at home Mother microsoft.public.windows.vista.general 0 11-21-2007 15:16
Toggle key Sounds BChat microsoft.public.windows.vista.general 3 10-09-2007 23:15




All times are GMT +1. The time now is 05:59.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com and Win7Heads.com.


Funny Commercials to make you laugh :-)

Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119