sshrum Posted July 13, 2005 Share Posted July 13, 2005 ...without having the script that is making the check hose. Currently, I'm writting a script that is doing version checking against a file I host off my server. Problem is that if the user running the program is not connected as in modem or bad DSL connection (me being the latter as of late), the AutoIT app seems to lock (waiting for a timeout perhaps). Is there a way that will *quickly* tell if the computer has a live inet connection? TIA Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
Baku Posted July 13, 2005 Share Posted July 13, 2005 (edited) Use the ping command and ping a host... If @error appears, you are offline, if not, online... Maybe there is a proccess what starts with the connection, maybe you can check it... Dunno any other way. Edited July 13, 2005 by Baku Link to comment Share on other sites More sharing options...
buzz44 Posted July 13, 2005 Share Posted July 13, 2005 ;-------------------------------------------------------------------------------------------- ;check $ret[0] for trueness, and $ret[1] for type of connection according to variables provided... ;-------------------------------------------------------------------------------------------- $INTERNET_CONNECTION_MODEM = 0x1 $INTERNET_CONNECTION_LAN = 0x2 $INTERNET_CONNECTION_PROXY = 0x4 $INTERNET_CONNECTION_MODEM_BUSY = 0x8 $INTERNET_RAS_INSTALLED = 0x10 $INTERNET_CONNECTION_OFFLINE = 0x20 $INTERNET_CONNECTION_CONFIGURED = 0x40 $ret = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0) If $ret[0] then ;check type of connection $sX = "" If BitAND($ret[1], $INTERNET_CONNECTION_MODEM) Then $sX = $sX & "MODEM" & @LF If BitAND($ret[1], $INTERNET_CONNECTION_LAN) Then $sX = $sX & "LAN" & @LF If BitAND($ret[1], $INTERNET_CONNECTION_PROXY) Then $sX = $sX & "PROXY" & @LF If BitAND($ret[1], $INTERNET_CONNECTION_MODEM_BUSY) Then $sX = $sX & "MODEM_BUSY" & @LF If BitAND($ret[1], $INTERNET_RAS_INSTALLED) Then $sX = $sX & "RAS_INSTALLED" & @LF If BitAND($ret[1], $INTERNET_CONNECTION_OFFLINE) Then $sX = $sX & "OFFLINE" & @LF If BitAND($ret[1], $INTERNET_CONNECTION_CONFIGURED) Then $sX = $sX & "CONFIGURED" & @LF Else $sX = "Not Connected" Endif MsgBox(4096,$ret[0] & ":" & $ret[1],$sX) qq Link to comment Share on other sites More sharing options...
LxP Posted July 14, 2005 Share Posted July 14, 2005 (edited) Fantastic, Burrup! Does that code already exist somewhere on the Scripts and Scraps forum?Also, out of curiosity why do you use $sX & in the code below?$sX = $sX & "MODEM" & @LF Edited July 14, 2005 by LxP Link to comment Share on other sites More sharing options...
buzz44 Posted July 14, 2005 Share Posted July 14, 2005 Don't ask me lol. Its from AutoIt Wiki http://www.autoitscript.com/wiki/index.php?title=Connected qq Link to comment Share on other sites More sharing options...
blindwig Posted July 14, 2005 Share Posted July 14, 2005 Fantastic, Burrup! Does that code already exist somewhere on the Scripts and Scraps forum?Also, out of curiosity why do you use $sX & in the code below?$sX = $sX & "MODEM" & @LF<{POST_SNAPBACK}>The ampersand symbol if for concatenating strings. So a command like this:$sX = $sX & 'some literal string'or$sX = $sX & $sYmeans that $sX now contains its original contents with the new string (literal or variable) concatenated on to the end. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
LxP Posted July 14, 2005 Share Posted July 14, 2005 Thanks blindwig, but I was curious as to why this was being used when $sX was being explicitly cleared initially.And then it dawned on me: possibly more than one if test may return true and so $sX may hold more than one flag at any time.Apologies for the lack of attention earlier! 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