daslick Posted October 6, 2006 Share Posted October 6, 2006 I've even tried $keyname = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" _ra("reg add "& $keyname &" /v ProxyEnable /t REG_DWORD /d 1 /f") _ra("reg add "& $keyname &" /vProxyServer REG_SZ /d 123.123.123.123:8080 /f") All I need to do is add the following keys using my function _ra() which is the equivalant to run except it uses my passords. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]"ProxyEnable"=dword:00000000 "ProxyServer"="217.128.149.16:8080" Where the proxy's address is I need to it be a variable I've been working all day on this!!!!! PLEASE! Link to comment Share on other sites More sharing options...
nikink Posted October 6, 2006 Share Posted October 6, 2006 I've even tried $keyname = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" _ra("reg add "& $keyname &" /v ProxyEnable /t REG_DWORD /d 1 /f") _ra("reg add "& $keyname &" /vProxyServer REG_SZ /d 123.123.123.123:8080 /f") All I need to do is add the following keys using my function _ra() which is the equivalant to run except it uses my passords. Where the proxy's address is I need to it be a variable I've been working all day on this!!!!! PLEASE! Erm, why not use regwrite? Link to comment Share on other sites More sharing options...
sulfurious Posted October 6, 2006 Share Posted October 6, 2006 $x = RunWait(@ComSpec & " /c reg add HKLM\Software\Atest\Settings /v ProxyEnable /t REG_DWORD /d 0x00000000 /f") $y = RunWait(@ComSpec & " /c reg add HKLM\Software\Atest\Settings /v ProxyServer /t REG_SZ /d 211.211.211.211 /f") Create your variables and insert them. Sul Link to comment Share on other sites More sharing options...
daslick Posted October 6, 2006 Author Share Posted October 6, 2006 I ended up using regwrite - but the reason I avoided it was because it didn't say in the helpfile (unless I missed it) that the reg commands use the runasset credentials. I got so bored I tested it and it works! If someone wants it, I will post my instant proxy program. If you have a proxy handy you can use that as input and it will open internet explorer with that proxy as a temp setting, if you don't have a proxy it uses google translate on your link. Link to comment Share on other sites More sharing options...
sulfurious Posted October 6, 2006 Share Posted October 6, 2006 Why are you writing registry values and not using the proxy settings in your browser? I use a proxy, but I just set it up in the browser preferences. Just curious. Sul Link to comment Share on other sites More sharing options...
daslick Posted October 6, 2006 Author Share Posted October 6, 2006 (edited) I'm making this script set up a proxy for 1 time use, so what it does (or is supposed to do) is add the reg values that specify the proxy, open internet explorer, then delete the registry values. I have tested this by hand and it does work. Internet Explorer only checks for those registy keys when it is opening, so after it is opened if I delete them I can use the proxy only untill I close the browser I'll post the spaggetti code I have so far... _web($proxy) sets the reg values, opens IE, and deletes the reg values. Func _web($proxy) $howrun = "regadd" $regkey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $regvalue = "ProxyEnable" $regtype = "REG_DWORD" $regdata = "1" _ra("reg") $regvalue = "ProxyServer" $regtype = "REG_SZ" $regdata = $proxy _ra("reg") _IECreate("http://www.google.com") $howrun = "regadd" $regvalue = "ProxyEnable" $regtype = "REG_DWORD" $regdata = "0" _ra("reg") $regvalue = "ProxyServer" $regtype = "REG_SZ" $regdata = "" _ra("reg") $howrun = "norm" EndFunc _ra($file) tries my passwords Func _ra($file) RunAsSet("Admin", @Computername, "pass") if $howrun = "norm" then Run($file) if $howrun = "hide" then Run ($file, "", @SW_HIDE,) if $howrun = "regadd" then RegWrite($regkey, $regvalue, $regtype, $regdata) if @error = "0" then $file = "null" RunAsSet("Administrator", @Computername, "password") if $howrun = "norm" then Run($file) if $howrun = "hide" then Run ($file, "", @SW_HIDE,) if $howrun = "regadd" then RegWrite($regkey, $regvalue, $regtype, $regdata) if @error = "0" then $file = "null" EndFunc This is the button that starts the chaos. Case $msg = $filter dim $myproxy dim $pickbypass $pickbypass = MsgBox(3, "Bypass Web Filters", "Do you have a proxy to use?" & @CRLF & @CRLF & " Example: 203.1.13.192:8080") if $pickbypass = "6" then $myproxy = InputBox( "Bypass Web Filters", "Enter the proxy's ip address followed by the port:" & @CRLF & @CRLF & " Example: 163.135.215.93:3128", "" , "" , .3 * @DesktopWidth, .18 * @DesktopHeight ) ;InputBox ( "Create a new Administrator!", "Enter a new user name:", "" , "" , .32 * @DesktopWidth, .15 * @DesktopHeight ) if not $myproxy = "" then _web($myproxy) if $pickbypass = "7" then $site = InputBox ( "Quick proxy", "Enter the website that you would like to visit:" & @CRLF & @CRLF & "Example: myspace.com" , "" , "" , .25 * @DesktopWidth, .19 * @DesktopHeight ) if $pickbypass = "7" then _IECreate ("http://www.google.com/translate?u=" & $site & "&langpair=en-en%7Cen&hl=en&ie=UTF8") It works except it is not REMOVING the registry key like is should. Edited January 1, 2007 by daslick Link to comment Share on other sites More sharing options...
sulfurious Posted October 6, 2006 Share Posted October 6, 2006 Intersting concept. I wonder if you could do the same to firefox. In the C:\Program Files\Mozilla Firefox\greprefs director is a file called All.js. There are proxy entries here. This example is for localhost pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1"); Maybe you could do a FileRead, StringInStr for whatever the default would be, and then change that. Fire up mozilla, then change the line back. Don't know, I don't really use firefox. I tried it on Opera, which uses an ini file. Works pretty sweet. Find the entry, set the value, start Opera, change the value, shut down. Gone. Kinda cool if you use different proxies frequently. I dont' see any code for the deletion. The reg functions in autoit have always worked for me. You could also use reg delete from @comspec. Or you could just create a static .reg file which removes the value and call it. Sul Link to comment Share on other sites More sharing options...
daslick Posted October 6, 2006 Author Share Posted October 6, 2006 (edited) I am not looking into using other browsers because I will be using this tool on computer with only IE installed. Func _web($proxy) $howrun = "regadd" $regkey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $regvalue = "ProxyEnable" $regtype = "REG_DWORD" $regdata = "1" _ra("reg") $regvalue = "ProxyServer" $regtype = "REG_SZ" $regdata = $proxy _ra("reg") $howrun = "norm" runasset() _IECreate("google.com", 0, 1, 1, 0) ;pause for 5 seconds here? $howrun = "regdel" $regkey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $regvalue = "ProxyEnable" $regtype = "REG_DWORD" $regdata = "1" _ra("reg") $regvalue = "ProxyServer" $regtype = "REG_SZ" $regdata = $proxy _ra("reg") $howrun = "norm" EndFunc How do I wait for a few seconds before proceeding to the next step? EDIT: nevermind - I found sleep() Edited October 6, 2006 by daslick Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now