GEOSoft Posted October 11, 2008 Share Posted October 11, 2008 Sorry for my previous short post, when i sent it, autoit forum server got out of order. I wanted to say that i'am using onEvent mode, but speed is same as in MessageLoop, i tested it. Below is code which i'm using now. It works fine when ping is under 400-500ms, but after that i really feel lagging (every 2sec). Maybe is martin in #13 right and it needs only changing time in AdlibEnable, but i think while is AdlibEnable function executing, it pauses the script and this is written in autoit help too. So if i change time in adlibenable to 4000ms, it will only lagging every 4sec. However, i can't test it now, because i am home this weekend and here're pings ~40ms so speed of script is very good. #include <GUIConstantsEx.au3> AdlibEnable("doping", 2000) Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("lamp", 170, 25) GUISetOnEvent($GUI_EVENT_CLOSE, "_quit") GUICtrlCreateLabel("Internet connection:", 40, 5) $net = GUICtrlCreateGraphic(145,7,20,10) GUICtrlSetGraphic($net, $GUI_GR_ELLIPSE, 0,0, 11,11) GUISetState(@SW_SHOW) While 1 Sleep(40) WEnd Func doping() ConsoleWrite("doing the ping thing" & @CRLF) $online = Ping("216.239.59.99") ConsoleWrite($online & @CRLF) If $online > 0 Then GUICtrlSetGraphic($net, $GUI_GR_COLOR, 0x00ff00, 0x00ff00) GUICtrlSetGraphic($net, $GUI_GR_ELLIPSE, 0,0, 10,10) GUICtrlSetGraphic($net, $GUI_GR_REFRESH) Else GUICtrlSetGraphic($net, $GUI_GR_COLOR, 0xff0000, 0xff0000) GUICtrlSetGraphic($net, $GUI_GR_ELLIPSE, 0,0, 10,10) GUICtrlSetGraphic($net, $GUI_GR_REFRESH) EndIf EndFunc Func _quit() Exit EndFunc I tryed dllcall too (examples in #10, #15 and #17, #14 i couldn't implement), but it looks like it shows status of my network adapter, but i need verify connection to any server on internet.#14 was just an example of using the dll call to set the staes of controls if you lost the connection. Using the dll call and referencing element [0] tells you if you do or do not have an internet connection whereas using ping will really only tell you if you are getting a response from the server that you pinged, which will not happen if that particular server happens to be down. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gadelat Posted October 11, 2008 Author Share Posted October 11, 2008 yeah and dllcall says that i'm online when internet is not working because i have bad IP address or ISP have problems. So getting resolve from server (for example google - chance of felt down 1:FFFFFFFFFFF) is much better. 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