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


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

Toggle themes code in 64 bit system

Started byemf <emfril@gmail.com>
First post2017-02-26 21:17 -0500
Last post2017-02-27 11:03 +0700
Articles 2 — 2 participants

Back to article view | Back to microsoft.public.scripting.vbscript


Contents

  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

#11584 — Toggle themes code in 64 bit system

Fromemf <emfril@gmail.com>
Date2017-02-26 21:17 -0500
SubjectToggle themes code in 64 bit system
Message-ID<o9027t$151u$1@gioia.aioe.org>
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

[toc] | [next] | [standalone]


#11585

FromJJ <jj4public@vfemail.net>
Date2017-02-27 11:03 +0700
Message-ID<104vwmvs864p3.1uvp5pk8fceal.dlg@40tude.net>
In reply to#11584
On Sun, 26 Feb 2017 21:17:38 -0500, emf wrote:
> 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"
[snip]

Make sure the theme files exist in those two paths.

[toc] | [prev] | [standalone]


Back to top | Article view | microsoft.public.scripting.vbscript


csiph-web