Jump to content

Recommended Posts

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 post
Share on other sites
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 post
Share on other sites

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 post
Share on other sites

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 post
Share on other sites
  • Developers

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 post
Share on other sites

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 post
Share on other sites
  • Developers
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

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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By kartune
      Hi, i would like to know if there is a possible way to use subsections for ini files?
      For example, my ini file would look something like this:
       
      Clientname.ini
      [Info]
      Country=USA
      Type=Distributor
       
      [Costs]
      [[JAN]] <----- subsection
      cost1=----
      cost2=----
      [[FEB]]
      cost1=----
      cost2=----
       
      [Sales]
      [[JAN]] <----- subsection
      sale1=----
      sale2=----
      [[FEB]]
      sale1=----
      sale2=----
       
      [Profits]
      [[JAN]] <----- subsection
      prof1=----
      prof2=----
      [[FEB]]
      prof1=----
      prof2=----
       
      The sales would be inputed everyday by the script, and then whenever viewed, i would be using an array to view every sale/cost/profit under the subsection
       
       
      Thanks for your time!
    • By TheDcoder
      Hi, I have a 2D array with 2 columns, the 1st column contains a "version string" and the 2nd column contains a generic string. I want to sort it in the descending order so the latest version comes first.
      #include <Array.au3> Local $aVersionsAndReleases[4][2] = [["0.2.8.9", "Release #1"], ["0.2.9.10", "Release #3"], ["0.2.9.11", "Release #4"], ["0.2.8.10", "Release #2"]] _ArraySort($aVersionsAndReleases, 1) ConsoleWrite(_ArrayToString($aVersionsAndReleases, ' - ')) _ArrayDisplay($aVersionsAndReleases) Unfortunately, _ArraySort isn't working here . This is the output generated by the script:
      0.2.9.11 - Release #4 0.2.9.10 - Release #3 0.2.8.9 - Release #1 0.2.8.10 - Release #2 The expected result should be:
      0.2.9.11 - Release #4 0.2.9.10 - Release #3 0.2.8.10 - Release #2 0.2.8.9 - Release #1 I am looking to develop an function which does this... but I don't know where to start . Can someone help me get started? Thanks in Advance!
      - TD.
    • By careca
      Hi, im trying to get the file version. "16.612.1119.0"
      This is what i did, and what i got.
      ConsoleWrite(FileGetVersion (@ScriptDir&"\SciTE4AutoIt3.exe", "FileVersion") &@CRLF) Result:
      ${MyVersion}
      What am i missing here?

    • By Vivaed
      I am trying to read all the files in a folder, then whatever file is newest, keep only that one and delete the rest.
      Example files:  (these all have version numbers embedded in them, I dont want to rely on the file name)
      Faint.exe
      Faint-v2.0.exe
      Faint-v3.0.exe
      Faint-v4.0.exe
       
      What I have so far:
      #include <File.au3> RemoveOldFiles() ConsoleWrite(FileGetVersion("C:\WB Resources\FAINT_DONT_LINK_THESE\Faint-v4.0.0.exe") &@CRLF) Func RemoveOldFiles() Local $aFileList = _FileListToArray("C:\WB Resources\FAINT_DONT_LINK_THESE\", "*.exe",$FLTA_FILES) For $i = 0 To UBound($aFileList) - 1 $aFileVersion = FileGetVersion($aFileList[$i]) ConsoleWrite($aFileList[$i] & @CRLF) ConsoleWrite($aFileVersion & @CRLF) Next EndFunc OUTPUT: >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\bot\ownCloud\WellBeats\Delete Old Files\delete-test.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop 3 0.0.0.0 a.exe 0.0.0.0 b.exe 0.0.0.0 Faint-v4.0.0.exe 0.0.0.0 4.0.0.18 <-- This is the correct file version.... +>07:34:26 AutoIt3.exe ended.rc:0 +>07:34:26 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.6647 Not sure what I am missing here?
      Thanks!
    • By ur
      How to get the thrid number of a file version.
      Example: Let's say I have a file with below properties.
      I want only the third number like here it is 1941 as highlighted.
      Is there any built in function to get it??

×
×
  • Create New...