gcue Posted January 13, 2010 Share Posted January 13, 2010 (edited) i am comparing software versioning but cannot seem to get a proper reading.. the script below doesnt show that the $local_version < $remote_version $local_version = "10.20.0.0" ;~ $remote = "9.0.0.0" $remote_version = "10.20.0.1" if Number($local_version) < Number($remote_version) Then ConsoleWrite("exiting" & @lf) EndIf the help file says Number("3.14") ;returns 3.14 any ideas? Edited January 13, 2010 by gcue Link to comment Share on other sites More sharing options...
JoseS Posted January 13, 2010 Share Posted January 13, 2010 i am comparing software versioning but cannot seem to get a proper reading.. the script below doesnt show that the $local_version < $remote_version $local_version = "10.20.0.0" ;~ $remote = "9.0.0.0" $remote_version = "10.20.0.1" if Number($local_version) < Number($remote_version) Then ConsoleWrite("exiting" & @lf) EndIf the help file says Number("3.14") ;returns 3.14 any ideas? The way I would do it (and some of the experts can correct me if I'm wrong...) would be to use StringCompare: $local_version = "10.20.0.0" ;~ $remote = "9.0.0.0" $remote_version = "10.20.0.1" $test = StringCompare($local_version,$remote_version) If $test = 0 Then ConsoleWrite("Strings are the same..." & @CRLF) ElseIf $test > 0 Then ConsoleWrite("Local is greater than remote" & @CRLF) Else ConsoleWrite("Remote is greater than local" & @CRLF) EndIf J Link to comment Share on other sites More sharing options...
gcue Posted January 13, 2010 Author Share Posted January 13, 2010 works well! thanks =) Link to comment Share on other sites More sharing options...
gcue Posted January 13, 2010 Author Share Posted January 13, 2010 actually it doesnt work... as shown here: $local_version = "10.20.0.0" $remote_version = "9.0.0.0" $test = StringCompare($local_version,$remote_version) If $test = 0 Then ConsoleWrite("Strings are the same..." & @CRLF) ElseIf $test > 0 Then ConsoleWrite("Local is greater than remote" & @CRLF) Else ConsoleWrite("Remote is greater than local" & @CRLF) EndIf Link to comment Share on other sites More sharing options...
Developers Jos Posted January 13, 2010 Developers Share Posted January 13, 2010 What is wrong with _VersionCompare() ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
gcue Posted January 13, 2010 Author Share Posted January 13, 2010 hah didnt know it was there! was looking in all the wrong places.. number, stringcompare, etc =) thanks =) 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