Jump to content

Help with a code


 Share

Recommended Posts

This is my code to find fastest proxy available ( out of five ) and configure the same in Internet Explorer.

CODE
$gui = GUICreate("Connecting", 510, 40, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)

GUISetBkColor(0x3366FF)

GUISetFont(12, 900)

$Label_1 = GUICtrlCreateLabel("Configuring best proxy in Internet Explorer .......", 0, 10, 510, 20, $SS_CENTER)

GUICtrlSetColor(-1, 0xffffff)

GUISetState()

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1" )

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "ygncache.mpt.net.mm:8080" )

$begin = TimerInit()

$oIE = _IECreate("http://www.google.com/search?hl=en&q=local+time+in+chicago", 0, 0, 0, 0)

_IELoadWait($oIE, 0, 4000)

$dif1 = TimerDiff($begin)

if WinExists("Cannot") Then

$dif1 = "99999"

Endif

_IEQuit($oIE)

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.81:8080" )

$begin = TimerInit()

$oIE = _IECreate("http://www.google.com/search?hl=en&q=local+time+in+chicago", 0, 0, 0, 0)

_IELoadWait($oIE, 0, 4000)

$dif2 = TimerDiff($begin)

if WinExists("Cannot") Then

$dif2 = "99999"

Endif

_IEQuit($oIE)

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.82:8080" )

$begin = TimerInit()

$oIE = _IECreate("http://www.google.com/search?hl=en&q=local+time+in+chicago", 0, 0, 0, 0)

_IELoadWait($oIE, 0, 4000)

$dif3 = TimerDiff($begin)

if WinExists("Cannot") Then

$dif3 = "99999"

Endif

_IEQuit($oIE)

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.83:8080" )

$begin = TimerInit()

$oIE = _IECreate("http://www.google.com/search?hl=en&q=local+time+in+chicago", 0, 0, 0, 0)

_IELoadWait($oIE, 0, 4000)

$dif4 = TimerDiff($begin)

if WinExists("Cannot") Then

$dif4 = "99999"

Endif

_IEQuit($oIE)

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.84:8080" )

$begin = TimerInit()

$oIE = _IECreate("http://www.google.com/search?hl=en&q=local+time+in+chicago", 0, 0, 0, 0)

_IELoadWait($oIE, 0, 4000)

$dif5 = TimerDiff($begin)

if WinExists("Cannot") Then

$dif5 = "99999"

Endif

_IEQuit($oIE)

Dim $avArray[5]

$avArray[0] = $dif1

$avArray[1] = $dif2

$avArray[2] = $dif3

$avArray[3] = $dif4

$avArray[4] = $dif5

_ArraySort( $avArray)

if $avArray[0] = $dif1 Then

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "ygncache.mpt.net.mm:8080" )

EndIf

if $avArray[0] = $dif2 Then

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.81:8080" )

EndIf

if $avArray[0] = $dif3 Then

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.82:8080" )

EndIf

if $avArray[0] = $dif4 Then

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.83:8080" )

EndIf

if $avArray[0] = $dif5 Then

RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "203.81.80.84:8080" )

EndIf

This code runs perfectly . However I want to do a few things with it but I am not able to figure out how to do it.

1. I want to make this code read the proxy servers ip addresses from a ini file or something so that If i give the exe file to anyone along with the ini file he can add / remove proxies and change ip address of the proxies in the ini file whenever required in the future.

2. The fast proxy detection part is ok . but right now i am configuring the detected proxy in IE only and not Firefox ( its easier in IE because you can regwrite proxy easily, however I could not find any registry settings for proxy in Firefox ) If anyone knows better how to set proxy easily in firefox please let me know.

Any Help / Code would be really appreciated

Thanks

Edited by sumit
Link to comment
Share on other sites

IniRead()

IniRead ( "filename", "section", "key", "default" )
$var = IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")
MsgBox(4096, "Result", $var)oÝ÷ ØâZ¸­y«­¢+Ù%¹¥]É¥Ñ ÅÕ½Ðí¥±¹µÅÕ½Ðì°ÅÕ½ÐíÍÑ¥½¸ÅÕ½Ðì°ÅÕ½Ðí­äÅÕ½Ðì°ÅÕ½ÐíÙ±ÕÅÕ½Ðì¤()%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíQµÀÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½ÐíÍÑ¥½¸ÈÅÕ½Ðì°ÅÕ½Ðí­äÅÕ½Ðì°ÅÕ½ÐíÑ¡¥Ì¥Ì¹ÜÙ±ÕÅÕ½Ðì¤
Edited by narayanjr
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...