From 55ad65501d6c76587b67d4ad0ea16896f8170be2 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 25 May 2021 15:54:08 -0700 Subject: [PATCH] Add instructions to README; fix script I made @afxentios's useful change he recommended in his Stack Overflow comment here: https://stackoverflow.com/questions/18439373/batch-file-to-disable-internet-options-proxy-server/44752679#comment90518586_44752679 ie: I removed the hard-coded path with my name in it and replaced it with an automatic path. --- README.md | 14 ++++++++++++-- {Icons => icons}/off.ico | Bin {Icons => icons}/off.png | Bin {Icons => icons}/on.ico | Bin {Icons => icons}/on.png | Bin toggle_proxy_on_off.vbs | 4 ++-- 6 files changed, 14 insertions(+), 4 deletions(-) rename {Icons => icons}/off.ico (100%) rename {Icons => icons}/off.png (100%) rename {Icons => icons}/on.ico (100%) rename {Icons => icons}/on.png (100%) diff --git a/README.md b/README.md index 442da32..9965470 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Windows_Proxy_Toggler A clickable icon on your Windows desktop to toggle your proxy on and off. -See [my answer on Stack Overflow][my_ans] for details and more info. +See [my answer on Stack Overflow][my_ans] for more details and info. Here's what it looks like when the Proxy is OFF: @@ -26,8 +26,14 @@ Updated: 25 June 2017 Updated and added to GitHub: 25 May 2021 -# Instructions +# Installation and Usage Instructions +1. Download this repository directly into your **"C:\Users\YOUR_USERNAME"** folder. You will now have **"C:\Users\YOUR_USERNAME\Windows_Proxy_Toggler"**. +1. Now, double-click the **"C:\Users\YOUR_USERNAME\Windows_Proxy_Toggler\toggle_proxy_on_off.vbs"** file to run it. It will automatically create a **"Proxy On-Off"** shortcut file on your desktop, with the appropriate icon to indicate whether the Proxy is ON or OFF. +1. From this point on, just click the **"Proxy On-Off"** desktop shortcut directly to toggle the Proxy on and off! +1. _If you find this useful, tell me "thank you" by [upvoting my Stack Overflow answer on this here][my_ans]._ You can also [sponsor me on GitHub here](https://github.com/sponsors/ElectricRCAircraftGuy). Consider $1/month. + +That's it! See images of what the desktop shortcut and popup window look like, above. # References: @@ -37,6 +43,10 @@ Updated and added to GitHub: 25 May 2021 1. Timed message boxes: 1. \*\*\*\*\*https://technet.microsoft.com/en-us/library/ee156593.aspx 1. https://stackoverflow.com/questions/14105157/automatically-close-msgbox-in-vbscript +1. Original source for the two icon .png images (these links are dead now): + 1. ON icon image: http://s30.postimg.org/sgoerz0od/image.png + 1. OFF icon image: http://s13.postimg.org/9zha38zkj/off.png +1. How to convert those images to icons (.ico files): use http://icoconvert.com/, for example. Choose File (choose a .png from above) --> Upload --> choose "ICO for Windows 7, Windows 8, Vista and XP" format --> click "Convert ICO" --> click "Download your icon(s)". Debug output: - ex: Wscript.Echo "here is your message" diff --git a/Icons/off.ico b/icons/off.ico similarity index 100% rename from Icons/off.ico rename to icons/off.ico diff --git a/Icons/off.png b/icons/off.png similarity index 100% rename from Icons/off.png rename to icons/off.png diff --git a/Icons/on.ico b/icons/on.ico similarity index 100% rename from Icons/on.ico rename to icons/on.ico diff --git a/Icons/on.png b/icons/on.png similarity index 100% rename from Icons/on.png rename to icons/on.png diff --git a/toggle_proxy_on_off.vbs b/toggle_proxy_on_off.vbs index b789e50..39c05c8 100755 --- a/toggle_proxy_on_off.vbs +++ b/toggle_proxy_on_off.vbs @@ -9,7 +9,6 @@ Option Explicit 'Variables & Constants: Dim ProxySettings_path, VbsScript_filename -ProxySettings_path = "C:\Users\Gabriel\Proxy Settings" VbsScript_filename = "toggle_proxy_on_off.vbs" 'sec; change this value to set how long the message box displays when you toggle the proxy setting Const MESSAGE_BOX_TIMEOUT = 1 @@ -20,6 +19,7 @@ Set WSHShell = WScript.CreateObject("WScript.Shell") 'get the username string for use in path names, since trying to use the "%USERNAME%" variable 'directly in path names throws an error username = WSHShell.ExpandEnvironmentStrings("%USERNAME%") +ProxySettings_path = "C:\Users\" + username + "\Windows_Proxy_Toggler" 'Determine current proxy setting and toggle to opposite setting proxyEnableVal = wshshell.regread("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable") @@ -70,7 +70,7 @@ Sub CreateOrUpdateDesktopShortcut(onOrOff) ElseIf onOrOff = "off" Then iconStr = "off.ico" End If - shortcut.IconLocation = ProxySettings_path + "\Icons\" + iconStr + shortcut.IconLocation = ProxySettings_path + "\icons\" + iconStr 'Save the shortcut shortcut.Save End Sub