Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11584

Toggle themes code in 64 bit system

From emf <emfril@gmail.com>
Newsgroups microsoft.public.scripting.vbscript
Subject Toggle themes code in 64 bit system
Date 2017-02-26 21:17 -0500
Organization Aioe.org NNTP Server
Message-ID <o9027t$151u$1@gioia.aioe.org> (permalink)

Show all headers | View raw


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

Back to microsoft.public.scripting.vbscript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Toggle themes code in 64 bit system emf <emfril@gmail.com> - 2017-02-26 21:17 -0500
  Re: Toggle themes code in 64 bit system JJ <jj4public@vfemail.net> - 2017-02-27 11:03 +0700

csiph-web