t0ddie Posted November 2, 2005 Share Posted November 2, 2005 my script crashes when inetget is used and there is no internet connection. i tried a workaround, but it didnt work. Select Case $msg = $button1 call("update") the function was the workaround. i didnt have it go to a function before i started experimenting with detecting an internet connection. because if there was no connection it should return. here is the part of the function that i tried to check with. InetGet($remoteFile1, $localFile1, 1) $noconnect = @InetGetActive If $noconnect = -1 Then MsgBox(0,"Not connected!","The internet is not connected!") Return EndIf because it crashes when trying to get the file and there is no internet connection. i looked in the help file for another way to determine internet connection, like before i call inetget but could not find any. any suggestions? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 2, 2005 Share Posted November 2, 2005 i syour script crashing or just not doing anything? have you waited a while for it to continue you can check the connection via inetget if you want $a = inetget($remoteFile1, $localFile1, 1) if $a = 0 then MsgBox(0,"Not connected!","The internet is not connected!") Return EndIf hope this helps you my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
GaryFrost Posted November 2, 2005 Share Posted November 2, 2005 my script crashes when inetget is used and there is no internet connection.i tried a workaround, but it didnt work.Select Case $msg = $button1 call("update")the function was the workaround. i didnt have it go to a function before i started experimentingwith detecting an internet connection.because if there was no connection it should return. here is the part of the function that i tried to check with.InetGet($remoteFile1, $localFile1, 1) $noconnect = @InetGetActive If $noconnect = -1 Then MsgBox(0,"Not connected!","The internet is not connected!") Return EndIfbecause it crashes when trying to get the file and there is no internet connection. i looked in the help file for another way to determine internet connection, like before i call inetget but could not find any.any suggestions? Why not just try a simple ping of the host your trying to get the file from?$var = Ping("www.AutoItScript.com",250)If $var Then; also possible: If @error = 0 Then ... Msgbox(0,"Status","Online, roundtrip was:" & $var)Else Msgbox(0,"Status","An error occured with number: " & @error)EndIf SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jezzzzy Posted November 2, 2005 Share Posted November 2, 2005 There may be a better way to test internet connectivity. I usually use Ping() to test. Do you really need to download a file to see if internet is up? Try Ping() should work better. Link to comment Share on other sites More sharing options...
t0ddie Posted November 2, 2005 Author Share Posted November 2, 2005 (edited) @ first reply it just does nothing. then i try to close it and windows tells me the program is not responding. thanks that worked though. @second reply im not checking with the file... im already planning on having the file download. i just wanted to check the connection so when i get the file it doesnt crash and i can make it return instead. @third reply see @second reply Edited November 2, 2005 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
jezzzzy Posted November 2, 2005 Share Posted November 2, 2005 @second reply im not checking with the file... im already planning on having the file download. i just wanted to check the connection so when i get the file it doesnt crash and i can make it return instead.Ok. I understand. Your INetGet() shouldn't crash. On failure, it should just return 0. Maybe you can test connectivity with Ping() and then run your INetGet() as a workaround like this:$pingtest = Ping($remoteLocation) If $pingtest <> 0 Then InetGet($remoteFile1, $localFile1, 1) Else MsgBox(0,"Not connected!","The internet is not connected!") EndIf Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 2, 2005 Share Posted November 2, 2005 the time your script stops because the you are not connected it just stops for about 30secs up to 1 min, then it should work as usual my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
tonedeaf Posted November 2, 2005 Share Posted November 2, 2005 InetGetSize() returns 0 and sets @error to 1 if a file cannot be downloaded from internet. InetGetSize($sURL) If @error Then MsgBox(0,"Not connected!","The internet is not connected!") Else InetGet($remoteFile1, $localFile1, 1) EndIf 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