'togglecookies.vbs - Enable/Disable automatic acceptance of cookies '© Doug Knox - rev 12/14/99 '© Bill James - 12/14/99 'Based on YesCookies.vbs/NoCookies.vbs by Lee Chapelle, MS-MVP 'Modifications for Prompt, Enabled, Disabled by Bill James Option Explicit 'Declare variables Dim WSHShell, n, p, errnum, itemtype Dim OldVal, Msg, NewVal, ErrMsg, AskBox Set WSHShell = WScript.CreateObject("WScript.Shell") p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" p = p & "Zones\3\1A02" itemtype = "REG_DWORD" 'This section tries to read the registry key value. If not present an 'error is generated. Normal error return should be 0 if value is 'present On Error Resume Next Err.Clear n = WSHShell.RegRead (p) errnum = Err.Number On Error Goto 0 if errnum <> 0 then 'Create the registry key value 0 WSHShell.RegWrite p, 0, itemtype End If '=============begin modifications by Bill James======================== 'current settings to display. If n = 0 Then OldVal = "automatic." If n = 1 Then OldVal = "prompt." If n = 3 Then OldVal = "disabled." Msg = "Cookies acceptance is currently set to " & OldVal GetInput() 'call sub WSHShell.RegWrite p, n, itemtype 'write the new value to Registry. 'Show the new setting. MsgBox "Cookie acceptance is" & NewVal, 4096, "Cookie Cutter Utility" Set WSHShell = Nothing WSH.Quit Sub GetInput AskBox = InputBox(ErrMsg & Msg & vbcrlf & vbcrlf & _ "Select a choice from the list to change Cookies acceptance" & _ " settings, or click Cancel to exit" & vbcrlf & vbcrlf & _ "1. Accept Cookies automatically." & vbcrlf & _ "2. Prompt me when Cookies are attempted." & vbcrlf & _ "3. Never accept Cookies.","Cookie Cutter Utility") If AskBox = "" Then WSH.quit 'user clicked cancel or made no input. If IsNumeric(AskBox) = False Then AskBox = 0 'non-interger input. If AskBox < 1 Or AskBox > 3 Then 'invalid selection - loop for valid input. ErrMsg = "INVALID SELECTION -- ENTER 1, 2, or 3 ONLY." & vbcrlf & vbcrlf GetInput() End If If AskBox = 1 Then n = 0 NewVal = " automatic." ElseIf AskBox = 2 Then n= 1 NewVal = " prompt." ElseIf AskBox = 3 Then n = 3 NewVal = " disabled." End If End Sub '=============== End modifications by Bill James ==============