ur Posted March 17, 2017 Share Posted March 17, 2017 In the present product I have version in the About section as 4 section one like (10.00.00.2456) And the version in other products I have version number like (97.000.2456 , 10.000.2345) Is there any UDF or function to convert 4 digit format to 3 digit one.? I need that for version comparison of different products. Link to comment Share on other sites More sharing options...
Subz Posted March 17, 2017 Share Posted March 17, 2017 Why not use _VersionCompare function? Link to comment Share on other sites More sharing options...
ur Posted March 17, 2017 Author Share Posted March 17, 2017 39 minutes ago, Subz said: Why not use _VersionCompare function? It won't work in this case as the format is different. As the first string is 10.000.2345 and second is 10.00.00.2345.And the VersionCompare will result as -1 Link to comment Share on other sites More sharing options...
Subz Posted March 17, 2017 Share Posted March 17, 2017 Returns 1 for me (Version 1 is greater): #include <Misc.au3> MsgBox(0,'', _VersionCompare("10.000.2345", "10.00.00.2345")) Link to comment Share on other sites More sharing options...
ur Posted March 17, 2017 Author Share Posted March 17, 2017 Yeah, but it should be equal.. Link to comment Share on other sites More sharing options...
Subz Posted March 17, 2017 Share Posted March 17, 2017 Why would it be equal? It's normally implied that a version has four sections, when one section is omitted it assumes 0, so 10.000.2345 would become 10.000.2345.0. 10 = Major revision 00 = Minor revision The last two can be mixed depending on the developer 00 = Patch release 2345 = Build number Link to comment Share on other sites More sharing options...
ur Posted March 17, 2017 Author Share Posted March 17, 2017 The 4 version format is olde format in window and it is converted to 3 section format from windowws 7 onwards. If you check in server 2008, both file and product version of a exe are 4 section and from windows 2012 it is different. So , if we leave about the standards, is there any solution to convert the 4 section to 3 section format.? Link to comment Share on other sites More sharing options...
Developers Jos Posted March 17, 2017 Developers Share Posted March 17, 2017 What is the exact conversion between the 2 formats for my understanding? (so I don't have to do the research myself) Jos 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...
ur Posted March 17, 2017 Author Share Posted March 17, 2017 Actually, the first string is 10.000.2345 and second is 10.00.00.2345 As the 4 section one, 2nd and 3rd should be merged. may be if 10.01.34.2345 then it merged as 10.134.2345 if 10.00.34.2345 then it merged as 10.034.2345 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 17, 2017 Developers Share Posted March 17, 2017 So I think you are giving the solution to code your UDF ...right? Jos 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...
ur Posted March 17, 2017 Author Share Posted March 17, 2017 No, I tried to code, but someone in my team mentioend that a solition already exists as UDF in the portal. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 17, 2017 Developers Share Posted March 17, 2017 3 minutes ago, ur said: No, I tried to code, but someone in my team mentioend that a solition already exists as UDF in the portal. No idea what this means. What did you try to code? It could very well be somebody tackled this issue before but to me it is as simple as this: #include <Misc.au3> Func _My_VersionCompare($sVersion1, $sVersion2) $V1 = StringSplit($sVersion1, ".") $V2 = StringSplit($sVersion2, ".") If $V1[0] = 4 Then $sVersion1 = $V1[1] & "." & $V1[2] & $V1[3] & "." & $V1[4] EndIf If $V2[0] = 4 Then $sVersion2 = $V2[1] & "." & $V2[2] & $V2[3] & "." & $V2[4] EndIf Return _VersionCompare($sVersion1, $sVersion2) EndFunc ;==>_My_VersionCompare ConsoleWrite('_VersionCompare("10.000.2345", "10.00.00.2345") = ' & _VersionCompare("10.000.2345", "10.00.00.2345") & ' >Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('_My_VersionCompare("10.000.2345", "10.00.00.2345") = ' & _My_VersionCompare("10.000.2345", "10.00.00.2345") & ' >Error code: ' & @error & @CRLF) ;### Debug Console Agree? Jos ur 1 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...
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