Didonet Posted September 8, 2007 Share Posted September 8, 2007 (edited) I have a drop-down menu in my program.Like that:$connectitem = GUICtrlCreateMenuitem ("Login",$filemenu)If Ping("my.site.com",250) Then GUICtrlSetState(-1,$GUI_DISABLE)$disconnectitem = GUICtrlCreateMenuitem ("Logout",$filemenu)If Not Ping("my.site.com",250) Then GUICtrlSetState(-1,$GUI_DISABLE)When the program loads it pings the site. But when the connection is lost the info is still the old. Can i refresh it ? I try with WHILE, but it didn't works.I try this:$disconnectitem = GUICtrlCreateMenuitem ("Logout",$filemenu)While 1 $msg = GUIGetMsg() Select Case $msg = $disconnectitem If Not Ping("forum.recbg.net",250) Then GUICtrlSetState(-1,$GUI_DISABLE) EndIf EndSelectWEndError:myscript.au3 (28) : ==> Variable used without being declared.: If Ping("my.site.com",250) Then GUICtrlSetState(-1,$GUI_DISABLE) If Ping("my.site.com",250) Then GUICtrlSetState(-1,^ ERRORWhat a spammer am i... Edited September 8, 2007 by Didonet Link to comment Share on other sites More sharing options...
Gif Posted September 8, 2007 Share Posted September 8, 2007 (edited) $disconnectitem = GUICtrlCreateMenuitem ("Logout",$filemenu) While 1 $msg = GUIGetMsg() Select Case $msg = $disconnectitem If Not Ping("forum.recbg.net",250) Then GUICtrlSetState($disconnectitem, $GUI_DISABLE) EndIf EndSelect WEndyour error is that you use GUICtrlSetState(-1, $GUI_DISABLE) and -1 indicates the latest variable (item) used, so you cant use -1 you have to insert the variable of your menu item(i suggest that you change 250 [timeout] to a larger value, cause there is a possibility that it wont ping that site in 250 and there might be a false result) Edited September 8, 2007 by Gif Link to comment Share on other sites More sharing options...
Didonet Posted September 9, 2007 Author Share Posted September 9, 2007 Thanks again, @Gif! Thie ping timeout is 250, because the site is local and the timeout there is <4ms 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