Simple VBScript

Open Notepad

MSGBOX(1+1)

Save As Test.vbs

Advertisements

Proxy On-Off Script

Save As VBS file

Set WshShell = WScript.CreateObject("WScript.Shell")

DimSetting = WshShell.RegRead ("HKCUSOFTWAREMicrosoftWindowsCurrentVersionInternet SettingsProxyEnable")

If DimSetting = 1 Then 
'Wscript.Echo "Proxy is Currently Enabled"

returnvalue=MsgBox ("Do you want to DISABLE the Proxy?", 36, "Proxy state is Currently ENABLED")


if returnvalue = 6 then 
' BEGIN CALLOUT A
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyEnable", _
 0, "REG_DWORD"
' END CALLOUT A

wShshell.Run "taskkill /im iexplore.exe",0,True
WScript.Sleep 500 'give kill time to take effect

wShshell.Run "iexplore.exe"
End If
WScript.Quit


Else 
'Wscript.Echo "Proxy is Currently Disabled" 
End If


'On Error Resume Next

returnvalue=MsgBox ("Do you want to ENABLE the Proxy?", 36, "Proxy state is Currently DISABLED")

If returnvalue = "" Then
 WScript.Quit
End If

if returnvalue = 6 then 
' BEGIN CALLOUT A
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyEnable", _
 1, "REG_DWORD"
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyServer","proxy.test.edu:80", "REG_SZ"
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyOverride","<local>", "REG_SZ"
' END CALLOUT A


wShshell.Run "taskkill /im iexplore.exe",0,True

WScript.Sleep 500 'give kill time to take effect

wShshell.Run "iexplore.exe"
End If

WScript.Quit

Excel Combine All Sheets VBA

Sub Combine()
Const sRANGE = "A1:Z100"
Dim iSheet, iTargetRow As Long, oCell As Object
Dim iTop, iLeft, iBottom, iRight As Long
Sheets(1).Select
Cells.Select
Selection.Clear
iTargetRow = 1
For iSheet = 2 To ThisWorkbook.Sheets.Count: DoEvents
Sheets(iSheet).Select
Range(sRANGE).Select
Selection.Copy
Sheets(1).Select
Cells(iTargetRow, 1).Select
ActiveSheet.Paste
iTargetRow = iTargetRow + Range(sRANGE).Rows.Count
Next
End Sub