Discussion:
Toggle themes code in 64 bit system
(too old to reply)
emf
2017-02-27 02:17:38 UTC
Permalink
I used the following code to toggle between 2 themes in my old 32bit
system. In my new 64 bit system it does not work. It says:

Line: 26
Char: 1
Error: The system cannot find the file specified.

What code should I use?

--------------------------------------------------

theme1 =
"C:\Users\Eustace\AppData\Local\Microsoft\Windows\Themes\Black.theme"
theme2 =
"C:\Users\Eustace\AppData\Local\Microsoft\Windows\Themes\White.theme"

with CreateObject("Scripting.FileSystemObject")
if .fileExists("theme.txt") then
set f=.getFile("theme.txt").OpenAsTextStream(1)
theme=f.readAll
theme=not theme
f.close
set f=.getFile("theme.txt").OpenAsTextStream(2)
f.writeLine theme
else
set f=.CreateTextFile("theme.txt")
theme=0
f.writeLine theme
f.close
end if
end with

if theme then
runstring=theme1
else
runstring=theme2
end if

CreateObject("Wscript.Shell").Run runstring

Set WshShell = WScript.CreateObject("WScript.Shell")
For i = 1 To 30
WScript.Sleep 1000
If WshShell.AppActivate("Personalization") Then
WshShell.Sendkeys "%FC"
WshShell.Sendkeys "{F4}"
Exit For
End If
Next
JJ
2017-02-27 04:03:08 UTC
Permalink
Post by emf
I used the following code to toggle between 2 themes in my old 32bit
Line: 26
Char: 1
Error: The system cannot find the file specified.
What code should I use?
--------------------------------------------------
theme1 =
"C:\Users\Eustace\AppData\Local\Microsoft\Windows\Themes\Black.theme"
theme2 =
"C:\Users\Eustace\AppData\Local\Microsoft\Windows\Themes\White.theme"
[snip]

Make sure the theme files exist in those two paths.

Loading...