mianz Posted October 7, 2008 Posted October 7, 2008 $datesplit = _StringSplit("18/11/2008", "/") $date_day = GUICtrlCreateCombo("", 128, 176, 38, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31") If $datesplit[0] < GUICtrlRead($date_day) Then call("test") lets say $datesplit[0] = 20 and GUICtrlRead($date_day) = 8 by right this shouldn't call test function, but it does. if $datesplit[0] = 20 and GUICtrlRead($date_day) = 16 this works fine as it won't call the function if $datesplit[0] = 20 and GUICtrlRead($date_day) = 23 this works fine as it call the function i found that it only did not work if GUICtrlRead($date_day) is from 1 to 9 i try to edit the combo box $date_day = GUICtrlCreateCombo("", 128, 176, 38, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31") now everything works perfectly fine. why is this so?
martin Posted October 7, 2008 Posted October 7, 2008 $datesplit = _StringSplit("18/11/2008", "/") $date_day = GUICtrlCreateCombo("", 128, 176, 38, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31") If $datesplit[0] < GUICtrlRead($date_day) Then call("test") lets say $datesplit[0] = 20 and GUICtrlRead($date_day) = 8 by right this shouldn't call test function, but it does. if $datesplit[0] = 20 and GUICtrlRead($date_day) = 16 this works fine as it won't call the function if $datesplit[0] = 20 and GUICtrlRead($date_day) = 23 this works fine as it call the function i found that it only did not work if GUICtrlRead($date_day) is from 1 to 9 i try to edit the combo box $date_day = GUICtrlCreateCombo("", 128, 176, 38, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31") now everything works perfectly fine. why is this so?It's a common brain problem Try this if "20" < "8" Then ConsoleWrite("????" & @CRLF) EndIf You are using strings but you think you are using numbers. You need to convert variables to Number before you compare them as numbers. If Number($datesplit[0]) < Number(GUICtrlRead($date_day)) Then call("test") Endif Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
water Posted October 7, 2008 Posted October 7, 2008 Hi mianz, I assume that Autoit sees the contents of your variables as strings. If this is true then a left to right comparison is done and therefore stops after the first character as "2" (as in "20") is lower then "8". Check the datatype with "Ifstring($datesplit[0])" HTH Thomas My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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