Add Proxy Adress in IE

Get help with using AutoHotkey and its commands and hotkeys
azmodian
Posts: 1
Joined: 19 Oct 2015, 00:58

Add Proxy Adress in IE

19 Oct 2015, 01:05

Hello,

so I got a script written in python collecting HQ Proxies and saving them into a .txt file.

What I now want to do is.

AHK should visit a certain website. After it visited the website and purchased something it should change my proxy which I provide from the .txt file.
(I need to purchase alot of products from this website but it blocks my IP after 2 purchases)

I found out how to put in 1 proxy but it should randomly choose from the .txt file or is it possible to implent alot of proxies in the ahk script and it choose a proxy random and bans the already used one?


This is the proxy part.

Code: Select all

;Set proxy via Registry
setproxy("192.168.20.112:3128","ON")
;Set Home Page, Change http://google.com to whatever you want
RegWrite,REG_SZ,HKCU,Software\microsoft\Internet Explorer\Main,Start Page,http://google.com
;Set ProxyOverride to your exception list separated by ';'
regwrite,REG_SZ,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyOverride,exception1;exception2;exception3 
return


;Function to SetProxy
setproxy(address = "",state = ""){ 
if (address = "") and (state = "") 
    state = TOGGLE 

if address
    regwrite,REG_SZ,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyServer,%address%
  if (state ="ON")
    regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,Proxyenable,1
  else if (state="OFF")
    regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,Proxyenable,0
  else if (state = "TOGGLE")
    {
      if regread("HKCU","Software\Microsoft\Windows\CurrentVersion\Internet Settings","Proxyenable") = 1
        regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,Proxyenable,0
      else if regread("HKCU","Software\Microsoft\Windows\CurrentVersion\Internet Settings","Proxyenable") = 0
        regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,Proxyenable,1 
    }
  dllcall("wininet\InternetSetOptionW","int","0","int","39","int","0","int","0")
  dllcall("wininet\InternetSetOptionW","int","0","int","37","int","0","int","0")
  Return
}

RegRead(RootKey, SubKey, ValueName = "") {
	RegRead, v, %RootKey%, %SubKey%, %ValueName%
	Return, v
}
Heezea
Posts: 53
Joined: 30 Sep 2013, 21:33

Re: Add Proxy Adress in IE

19 Oct 2015, 09:01

The following code will read the proxy text file into an array. A random number is generated to get a value from the array. That value is then deleted from the array. The remaining array is then read back to the proxy text file, overwriting the original values, so you end up with one less proxy value.

The proxy text file should be in the same directory as the AHK file, which it sounds like you are doing.

Code: Select all

aProxies := ""
aProxies := {}

Load(aProxies)

;~ aProxies[1] := "Testing"
;~ aProxies[2] := "Testing2"
;~ aProxies[3] := "Testing3"

Random, rand, 1, aProxies.MaxIndex()
Proxy := aProxies[rand]
aProxies.RemoveAt(rand)
MsgBox, % Proxy

Save(aProxies)

Load(ByRef aProxies)
{
	FileLoadName := "Proxies.txt"
	Loop, Read, %FileLoadName%
	{
		aProxies[A_Index] := A_LoopReadLine
	}
}

Save(ByRef aProxies)
{
	FileSaveName := "Proxies.txt"
	File := FileOpen(FileSaveName, "w")
	Loop, % aProxies.MaxIndex()
	{
		File.Write(aProxies[A_Index] "`r`n")
	}
	File.Close()
	Sleep 100
	return
}

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Crusader, Google [Bot], Kaisena, sxftsxinch-2, Timmy347 and 209 guests