cameleonowsky Posted January 6, 2010 Share Posted January 6, 2010 Hello, I'm trying to track my IP address. @IPaddress1 shows my IP correctly, but to find out the change (for example when LAN cable is disconnected) i must restart my program to see that my LAN network is down. I was trying to make something like: (...) while 1 $IP = @IPaddress1 Sleep(1000) ConsoleWrite($IP) Wend and its working correctly, but trying to put it in form by (...) $output=GuiCtrlCreateLAbel("IP: " & $IP,266,80,100,100) make the form unstable and unable or hard to close. Is there any way to make it simpler? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 6, 2010 Share Posted January 6, 2010 Instead of re-writing the label, use GUICtrlSetData. Checking if the data has changed, then using GUICtrlSetData, reduces/eliminates flicker. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
cameleonowsky Posted January 6, 2010 Author Share Posted January 6, 2010 yes, its working now but a little flicker still exist. But its ok, thank you ! How about IP address consist of for ex. "192.168.*.*" ? $IP = @IPaddress1 If Not $IP = "192.168.*.*" Then (...) autoit doesn't seem to like * star because its not working Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 7, 2010 Share Posted January 7, 2010 Add Sleep before GUICtrlSetData, 250 or so. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 7, 2010 Share Posted January 7, 2010 How about IP address consist of for ex. "192.168.*.*" ? $IP = @IPaddress1 If Not $IP = "192.168.*.*" Then (...) $IP = StringSplit(@IPaddress1, ".") ConsoleWrite(@IPaddress1 & @LF & $IP[1] & "." & $IP[2] & "." & $IP[3] & "." & $IP[4] & @LF) If $IP[1] = "192" And $IP[2] = "168" Then ;... - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
cameleonowsky Posted January 7, 2010 Author Share Posted January 7, 2010 Add Sleep before GUICtrlSetData, 250 or so. Nope, adding Sleep eliminates flicker, but whole application is being unstable and hard to close. But i've found an example using "AdlibEnable( function, time)" which eliminates flicker #include <GUIConstants.au3> GUICreate("Test") $label1 = GUICtrlCreateLabel("", 10, 10, 200, 20) GUISetState() AdlibEnable("UpdateLabel", 500) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Exit Func UpdateLabel() GUICtrlSetData($label1, "Label1" & Random(0, 500)) EndFunc Link to comment Share on other sites More sharing options...
james3mg Posted January 7, 2010 Share Posted January 7, 2010 (edited) yes, its working now but a little flicker still exist. But its ok, thank you ! How about IP address consist of for ex. "192.168.*.*" ? $IP = @IPaddress1 If Not $IP = "192.168.*.*" Then (...) autoit doesn't seem to like * star because its not working You can't use a wildcard when comparing strings using an equals sign. You could do it with RegExp (though the syntax would be a lot more complex than a simple star), but it would be easier to do something like: If StringLeft(@IPAddress1,8) <> "192.168." Then Edited January 7, 2010 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 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