Search the Community
Showing results for tags 'decimal compare'.
-
Never mind - changing the keywords I used to search means the answer was already existing - I will try this after I have some lunch. '?do=embed' frameborder='0' data-embedContent>> Hi all, A very noobish question, this is not working for me and I'm <easily> confused. I am remotely checking systems for a software version so that I can update the system (or prompt the user to update) if it is needed. The version to check against is in an INI file. I thought the right way was to use _WinAPI_FloatToInt() for each value then compare them to assure the checked value is either equal to or greater than the expected value. But the below does not work - it will return that 10.5 is greater than 10.5.2295 - so it's clear my inexperience is the problem (it even returns that 10.5.0000 is greater than 10.5.2295). What do I need to do to make the tool recognize the full decimal number? Note that sometimes the versions are actually seen as "xx.x" and others they are seen as "xx.xx.x" or "xx.xx.xxxx". Do I somehow need to "pad" each part of the string out if it's too short in order for the compare to work (and not use _WinAPI_FloatToInt())? If you know the answer please don't fix the code - instead tell me what I need to learn about to do this, if I get really stuck I will come back and ask for more help. #include <winapi.au3> $remtver = "10.5" ; lets say this is the remote system registry value $s_MinVer = "10.5.2295" ; The expected minimum $Check1 = _WinAPI_FloatToInt($remtver) $Check2 = _WinAPI_FloatToInt($s_MinVer) Select Case $Check1 >= $Check2 MsgBox(4096, "Pass", $remtver & " is greater than " & $s_MinVer) Case Else MsgBox(4096, "Fail", $remtver & " is less than " & $s_MinVer) EndSelect