autosm Posted January 7, 2015 Share Posted January 7, 2015 (edited) If $PingNum = 125 OR $PingNum < 125 Then GuiCtrlSetColor($PingNum, $COLOR_GREEN) Else GUICtrlSetColor($PingNum, 0xff0000) EndIf I have tried everything, using $COLOR_RED instead but nothing seems to work when I have $PingNum be over 125. It just doesn't want to come up as the color red when the variable is over 125. Edited January 7, 2015 by autosm Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 7, 2015 Moderators Share Posted January 7, 2015 (edited) Wait, what is $PingNum? You're using it as a controlid. Edit: BTW, if you're unsure or can't explain correctly (because your code makes little sense), then you're going to need to provide a working recreation script that demonstrates your issue. Not a conditional statement that really says nothing. BTW If $PingNum <= 125 Then is the same as your "Or" statement. Edited January 7, 2015 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
autosm Posted January 7, 2015 Author Share Posted January 7, 2015 I ping an ip adress and the ms gets set to $PingNum. Local $iPing = Ping("IP ADRESS THAT IS SET HERE", 1850) If $iPing Then ; If a value greater than 0 was returned then display the following message. GUICtrlSetData ($PingNum, $iPing) Else MsgBox($MB_SYSTEMMODAL, "", "An error occurred. If this conitues the region severs might be down/busy.") EndIF I have a few of those set my code based of of what radio button is selected. Everything works fine but my major issue is that when controlID PingNum is over 126 it doesnt set the color to red. Link to comment Share on other sites More sharing options...
jguinch Posted January 7, 2015 Share Posted January 7, 2015 $Label = GUICtrlCreateLabel("", 10, 10, 200, 25) ; [...] $ping = Ping($host, 2000) If $ping >= 125 Then $color = 0x00ff00 Else $color = 0xff0000 EndIf GUICtrlSetBkColor($label, $color) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
TheSaint Posted January 7, 2015 Share Posted January 7, 2015 @autosm - have a close look at the first code you posted. You have intermixed the ID or handle of your label, with your ping variable. This is why, it is always best to post a larger portion of code, than just some snippet. We can see instantly then, that you have made such a glaring mistake. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) 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