11-20-2019, 03:12 AM
this function should work for you.
Function GetFileVersionString
example
or you can
Download file Archive.qml: Collected QM apps, functions, samples
Import folder FileVersionInfo from it. It is in folder Functions, classes..
examples inside folder
Function GetFileVersionString
/
function# $file str&string [$infokind]
;Extracts string from version resource of exe or dll.
;infokind can be one of following strings (default is "FileDescription"):
;Comments InternalName ProductName CompanyName LegalCopyright ProductVersion FileDescription LegalTrademarks PrivateBuild FileVersion OriginalFilename SpecialBuild
;Returns 1 on success, 0 on failure.
;EXAMPLE
;str s
;if(GetFileVersionString("iexplore.exe" &s)) out s
;dll# version GetFileVersionInfoSize $lptstrFilename *lpdwHandle
;dll# version GetFileVersionInfo $lptstrFilename dwHandle dwLen !*lpData
;dll# version VerQueryValue !*pBlock $lpSubBlock !**lplpBuffer *puLen
if(!infokind or !infokind[0]) infokind="FileDescription"
str file2.searchpath(file); if(!file2.len) end "file not found"
int i vis=GetFileVersionInfoSize(file2, &i); if(!vis) ret
str s.all(vis 2) ss; word* lc; lpstr ls
if(!GetFileVersionInfo(file2, i, vis, s)) ret
if(!VerQueryValue(s, "\VarFileInfo\Translation", &lc, &i) or !lc or !i) ret
ss.format("\StringFileInfo\%04x%04x\%s" lc[0] lc[1] infokind)
if(VerQueryValue(s, ss, &ls, &i)) goto return
;lc[0] has problems with some programs (Word, Excel)
ss.format("\StringFileInfo\0409%04x\%s" lc[1] infokind)
if(VerQueryValue(s, ss, &ls, &i)) goto return
ret
;return
string=ls
ret 1
example
str filePath="$program files$\Windows Media Player\wmplayer.exe"
str s
if(GetFileVersionString(filePath &s "ProductVersion")) out s
;create folder with Product version as name
mkdir F"$Drive$\{s}"
or you can
Download file Archive.qml: Collected QM apps, functions, samples
Import folder FileVersionInfo from it. It is in folder Functions, classes..
examples inside folder