Jump to content

Recommended Posts

Posted

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??

asdsd.png

Posted

yeah I tried the below one and working.Used the inputs from Anoop.

 

#include <MsgBoxConstants.au3>
#include <Array.au3>

$sFilePath = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")
MsgBox(0,$sFilePath,getFileVersionBuildNumber($sFilePath))

Func getFileVersionBuildNumber($sFilePath)

$sStringName = "FileVersion"
Local $sStringValue = FileGetVersion($sFilePath, $sStringName)

If Not @error Then
    ;Display the property value.
    $b = StringSplit ( $sStringValue, '.' )[3]
    return $b
Else
    ;If error, display an error message.
    MsgBox($MB_ICONERROR, "", "Error when getting " & '"' & $sStringName  & '"')
EndIf

EndFunc

 

Posted
10 minutes ago, ur said:

yeah I tried the below one and working.Used the inputs from Anoop.

 

#include <MsgBoxConstants.au3>
#include <Array.au3>

$sFilePath = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")
MsgBox(0,$sFilePath,getFileVersionBuildNumber($sFilePath))

Func getFileVersionBuildNumber($sFilePath)

$sStringName = "FileVersion"
Local $sStringValue = FileGetVersion($sFilePath, $sStringName)

If Not @error Then
    ;Display the property value.
    $b = StringSplit ( $sStringValue, '.' )[3]
    return $b
Else
    ;If error, display an error message.
    MsgBox($MB_ICONERROR, "", "Error when getting " & '"' & $sStringName  & '"')
EndIf

EndFunc

 

Great to know that!!! :)

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
×
×
  • Create New...