emf
2017-02-27 02:17:38 UTC
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
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