Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

[AJUDA] Juntar 2 Scripts .vbs

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    [AJUDA] Juntar 2 Scripts .vbs

    Olá pessoal
    Sou iniciante em programação e gostaria de ajuda.

    Tenho 2 Scripts .vbs

    Script 1 = Habilita/Desabilita e Seta o Proxy. Pergunta se "Sim ou Não". Logicamente, Sim Ativa e Não Desativa.

    Script 2 = Desmarca Caixa de dialogo "Detectar automaticamente as configurações" com a variável "On ou Off" : sem pergunta nenhuma.

    Tudo isso em opções de internet.

    Gostaria de uma ajuda para o caso: se no primeiro script for "Sim" , automaticamente o script 2 seta o "Off" , e no caso de "Não" no script 1, seja setado o "On" no script 2.

    Não sei se deu para entender, mas se alguém puder me ajudar ficarei grato demais.

    Segue o código em .vbs

    Código:
    REM Script 1
    REM Habilita/Desabilita e Seta o Proxy
    
    Dim valUserIn
    Dim objShell, RegLocate, RegLocate1
    Set objShell = WScript.CreateObject("WScript.Shell")
    On Error Resume Next
    valUserIn = MsgBox("Usar Proxy Sala de Aula?",4,"Cloaked Select")
    If valUserIn=vbYes Then
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
    objShell.RegWrite RegLocate,"10.10.1.1:8080","REG_SZ"
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
    objShell.RegWrite RegLocate,"1","REG_DWORD"
    MsgBox "Proxy Ativado"
    else
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
    objShell.RegWrite RegLocate,"0.0.0.0:80","REG_SZ"
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
    objShell.RegWrite RegLocate,"0","REG_DWORD"
    MsgBox "Proxy Desativado"
    End If
    WScript.Quit
    
    
    REM Script 2
    REM Desmarca Caixa de dialogo "Detectar automaticamente as configuracoes"
    
    IEautomaticallydetect  "on"
      
    
    SUB IEautomaticallydetect (status)  
    
    	'howeasyisthat.com 
    	'The parameter shold be set to 'off', 'on' or 'show'. 
    	'This reads and writes to  HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings in order to 'set or read the Internet Explorer Automatically Detect facility. When a proxy is set, this should normally be off. When no proxy settings are set, 'it's usually best to have this setting turned on.[/size]  
    
    	DIM sKey,sValue,binaryVal 
    	Dim oReg 
    	Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")    
    
    	'For registry operations througout  
    
    	Const HKCU=&H80000001  
    	sKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" 
    	sValue = "DefaultConnectionSettings"  
    
    	oReg.GetBinaryValue HKCU, sKey, sValue, binaryVal  
    
    	select case lcase(status)   
    		case "on"	:	binaryVal(8) = binaryVal(8) OR 8       'Force Autodetect on   
    		case "off"	:	binaryVal(8) = binaryVal(8) XOR 8      'Force Autodetect off   
    		case "show"	:	wscript.echo "Automatically detect is set to " & ((binaryVal(8) and 8) = 8)   
    		case else	:	wscript.echo "Invalid parameter - IEautomaticallydetect  on, off or show" 
    	end select  
    
    	if lcase(status)="on" or lcase(status)="off" then oReg.SetBinaryValue HKCU, sKey, sValue, binaryVal  
    
    end sub
    -

    - - -
    - - -
    Similar Threads
X
Working...
X