cypher175 Posted August 7, 2009 Share Posted August 7, 2009 Im using _INetGetSource() to get the UTC Date, and after everything is attained the AutoIt.exe is still Not Disconnecting From Website After the Source Is Attained..?? It only disconnects from the website after you click the OK button.. Is there anyway to have it disconnect from the website immediately right after the source is attained and not after having to press the OK button in my code..?? #NoTrayIcon #include <INet.au3> #include <String.au3> #include <Misc.au3> _Singleton(@ScriptName) $DATE_SOURCE = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl") $DATE = _StringBetween($DATE_SOURCE, "<BR>", ",") $DATE = $DATE[0] MsgBox(0,"", '"'&$DATE&'"') Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 7, 2009 Share Posted August 7, 2009 Im using _INetGetSource() to get the UTC Date, and after everything is attained the AutoIt.exe is still Not Disconnecting From Website After the Source Is Attained..?? It only disconnects from the website after you click the OK button.. Is there anyway to have it disconnect from the website immediately right after the source is attained and not after having to press the OK button in my code..?? #NoTrayIcon #include <INet.au3> #include <String.au3> #include <Misc.au3> _Singleton(@ScriptName) $DATE_SOURCE = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl") $DATE = _StringBetween($DATE_SOURCE, "<BR>", ",") $DATE = $DATE[0] MsgBox(0,"", '"'&$DATE&'"') I'm not seeing it on my run. How are you monitoring the connection? Looking at the code, _INetGetSource() closes the handles with "InternetCloseHandle" and that should close the session. >_< Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
cypher175 Posted August 8, 2009 Author Share Posted August 8, 2009 I'm monitoring the connection with TCPView from http://technet.microsoft.com/en-us/sysinternals/bb897437.aspxAnd this is what I see in the TCPView App untill I click the OK button and the AutoIt3.exe PID ends..AutoIt3.exe:14260 TCP vm-ware.localdomain:2728 tycho.usno.navy.mil:http CLOSE_WAIT _INetGetSource() closes the handles with "InternetCloseHandle" and that should close the session.are you saying that "InternetCloseHandle" is a function inside the _INetGetSource() function that close the session, or are you saying to put "InternetCloseHandle" function after the _INetGetSource() function in my code to close the session like displayed in the code below..??#NoTrayIcon #include <INet.au3> #include <String.au3> #include <Misc.au3> _Singleton(@ScriptName) $DATE_SOURCE = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl") InternetCloseHandle() $DATE = _StringBetween($DATE_SOURCE, "<BR>", ",") $DATE = $DATE[0] MsgBox(0,"", '"'&$DATE&'"') Link to comment Share on other sites More sharing options...
Authenticity Posted August 8, 2009 Share Posted August 8, 2009 It's a function that gets called by _INetGetSource() which resides in wininet.dll (not sure). You should not call it, the function calls it internally. If you want to be more specific about the needs. You can use HTTP.au3, you can specify something like this, in the library: $command = "GET "&$page&" HTTP/1.1"&@CRLF $command &= "Host: " &$host&@CRLF $command &= "User-Agent: "&$_HTTPUserAgent&@CRLF $command &= "Connection: Close"&@CRLF $command &= ""&@CRLF ..to close the connection, or like this to keep it alive: $command = "GET "&$page&" HTTP/1.1"&@CRLF $command &= "Host: " &$host&@CRLF $command &= "User-Agent: "&$_HTTPUserAgent&@CRLF $command &= "Connection: Keep-Alive"&@CRLF $command &= ""&@CRLF Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 10, 2009 Share Posted August 10, 2009 _INetGetSource() closes the handles with "InternetCloseHandle" and that should close the session. are you saying that "InternetCloseHandle" is a function inside the _INetGetSource() function that close the session, or are you saying to put "InternetCloseHandle" function after the _INetGetSource() function in my code to close the session like displayed in the code below..?? #NoTrayIcon #include <INet.au3> #include <String.au3> #include <Misc.au3> _Singleton(@ScriptName) $DATE_SOURCE = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl") InternetCloseHandle() $DATE = _StringBetween($DATE_SOURCE, "<BR>", ",") $DATE = $DATE[0] MsgBox(0,"", '"'&$DATE&'"') No, it's called from inside a DLL, as Authenticity said. Open the INet.au3 UDF in SciTE and look inside the _INetGetSource() function to see how it was used. If you look that function up on MSDN, you'll see it was the proper way to close those handles. >_< Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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