Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

urldownloadtofile - var.. Proxy settings


  • Please log in to reply
No replies to this topic
DeWild1
  • Members
  • 369 posts
  • Last active: Feb 28 2014 08:15 PM
  • Joined: 30 Apr 2006
Hi Chris and the rest.. First off, thank you for making AHK. With it, a man with no formal educmacion for pregraming :wink: :lol: , has made many wonderful and powerful things..

On urldownloadtofile. I was having a hard time figuring out why some of my clients could not update.. or would have other strange things..
I am using some code to make sure my clients are connected to the internet, before my update check...
Well, 2 things.. One to not prompt them to connect.. To sit and wait for a connection.. The second to make sure my site-server is up...
srt:


If ConnectedToInternet()
  goto, udt22



else
sleep, 30000

goto, srt
Return

ConnectedToInternet(flag=0x40) {
Return DllCall("Wininet.dll\InternetGetConnectedState", "Str", flag,"Int",0)
}
udt22:
loop,
{
		UrlDownloadToFile, http://www.blalBlall.com/somepath/somefilewith000init.txt, %a_temp%\a748785215e1123e8f13335947712.tmp
		sleep, 100
		FileReadLine, status_return, %a_temp%\a748785215e1123e8f13335947712.tmp, 1
			sleep, 100
		FileDelete, %a_temp%\a748785215e1123e8f13335947712.tmp
			sleep, 100

ifnotequal, status_return, 000 
{
sleep, 30000
runwait, ipconfig /flushdns,,Hide
goto, udt22
}
	sleep, 1000
ifequal, status_return, 000 
 break


}


With a client who is using some lame proxy server - image distorting - acceleration type of software for dial up users, (like NetZero), it does not get past this section.. (I tested by replacing this,
ifnotequal, status_return, 000 
{
sleep, 30000
runwait, ipconfig /flushdns,,Hide
goto, udt22
}
with this,
ifnotequal, status_return, 000 
{
sleep, 30000
runwait, ipconfig /flushdns,,Hide
msgbox, WTF is going on???
}
... and I got the msgbox..)

So I am not sure how, but is there some way to incorporate a test in urldownloadtofile to make sure it is connected and functioning and if its not, maybe do this to bypass the proxy.. (its what I am doing right now to all my code... :roll: )
regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,Proxyenable,0

  dllcall("wininet\InternetSetOptionW","int","0","int","39","int","0","int","0")
  dllcall("wininet\InternetSetOptionW","int","0","int","37","int","0","int","0")