-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// This script captures keys that may contain settings beyond what can be set in WinSetView. | ||
// The reg file created by this script can be renamed to WinSetViewCustom.reg and placed in the | ||
// WinSetView AppData folder to provide additional custom settings. | ||
// If you don't know what you're doing, please do not use this extra level of customization! | ||
|
||
ForReading = 1; | ||
ForWriting = 2; | ||
Unicode = -1; | ||
Ansi = 0; | ||
vbCancel = 2; | ||
vbOKCancel = 1; | ||
vbInformation = 64; | ||
Z = "\r\n"; ZZ = Z + Z; | ||
|
||
oWSH = WScript.CreateObject("Wscript.Shell"); | ||
oFSO = WScript.CreateObject("Scripting.FileSystemObject"); | ||
|
||
function MsgBox(prompt, buttons, title) { | ||
oWSH.Popup(prompt, 0, title, buttons); | ||
} | ||
|
||
Temp = oWSH.ExpandEnvironmentStrings("%Temp%"); | ||
TempFile = Temp + "\\WinSetView.tmp"; | ||
CaptureFile = ".\\WinSetViewCustom.reg"; | ||
|
||
CPan = "\"" + "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel" + "\""; | ||
BagM = "\"" + "HKCU\\Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\BagMRU" + "\""; | ||
Bags = "\"" + "HKCU\\Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags" + "\""; | ||
|
||
RetVal = MsgBox("This is an optional configuration tool for power users." + ZZ + "Click OK to capture keys ControlPanel, BagMRU, and Bags to: " + CaptureFile, vbOKCancel, WScript.ScriptName); | ||
if (RetVal == vbCancel) WScript.Quit(); | ||
|
||
oOutput = oFSO.OpenTextFile(CaptureFile, ForWriting, true, Ansi); | ||
|
||
oOutput.Write("Windows Registry Editor Version 5.00" + ZZ); | ||
oOutput.Write("; Place this file in your WinSetView AppData folder to have it applied by WinSetView." + Z); | ||
|
||
oWSH.Run("Reg Export " + CPan + " " + TempFile + " /y", 0, true); | ||
|
||
oInput = oFSO.OpenTextFile(TempFile, ForReading, false, Unicode); | ||
while (!oInput.AtEndOfStream) { | ||
Line = oInput.ReadLine(); | ||
if (Line != "Windows Registry Editor Version 5.00") oOutput.Write(Line + Z); | ||
} | ||
oInput.Close(); | ||
|
||
oWSH.Run("Reg Export " + BagM + " " + TempFile + " /y", 0, true); | ||
|
||
oInput = oFSO.OpenTextFile(TempFile, ForReading, false, Unicode); | ||
while (!oInput.AtEndOfStream) { | ||
Line = oInput.ReadLine(); | ||
if (Line != "Windows Registry Editor Version 5.00") oOutput.Write(Line + Z); | ||
} | ||
oInput.Close(); | ||
|
||
oWSH.Run("Reg Export " + Bags + " " + TempFile + " /y", 0, true); | ||
|
||
oInput = oFSO.OpenTextFile(TempFile, ForReading, false, Unicode); | ||
while (!oInput.AtEndOfStream) { | ||
Line = oInput.ReadLine(); | ||
if (Line.indexOf("\\AllFolders") != -1) break; | ||
if (Line != "Windows Registry Editor Version 5.00") oOutput.Write(Line + Z); | ||
} | ||
oInput.Close(); | ||
|
||
oOutput.Close(); | ||
|
||
MsgBox("Done. See file: " + CaptureFile, vbInformation, WScript.ScriptName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
INIFile = ""; | ||
// INIFile = ".\\Win10.ini"; | ||
if (WScript.Arguments.length > 0) INIFile = WScript.Arguments(0); | ||
|
||
oWSH = WScript.CreateObject("Wscript.Shell"); | ||
oFSO = WScript.CreateObject("Scripting.FileSystemObject"); | ||
|
||
MyPath = oFSO.GetParentFolderName(WScript.ScriptFullName) | ||
oWSH.CurrentDirectory = MyPath; | ||
Z = "\r\n"; ZZ = Z + Z; | ||
|
||
function MsgBox(prompt, buttons, title) { | ||
oWSH.Popup(prompt, 0, title, buttons); | ||
} | ||
|
||
if (!oFSO.FileExists(INIFile)) { | ||
Msg = "Run WinSetView.exe to create or update an INI file." + ZZ; | ||
Msg += "Then drop the INI file on this script to run "; | ||
Msg += "WinSetView.ps1 with the saved settings." + ZZ; | ||
Msg += "This script can be relocated to the WinSetView AppData folder."; | ||
MsgBox(Msg, 0 + 64, "GUI-less Execution Instructions:"); | ||
} else { | ||
CmdLine = "Powershell.exe -ExecutionPolicy Bypass ..\\WinSetView.ps1 " + INIFile; | ||
oWSH.Run(CmdLine, 1, false); | ||
} |