Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create folder with version number
#2
this function should work for you.

Function GetFileVersionString
Code:
Copy      Help
/
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 
Code:
Copy      Help
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


Messages In This Thread
Create folder with version number - by Logi - 11-19-2019, 06:32 PM
RE: Create folder with version number - by Kevin - 11-20-2019, 03:12 AM
RE: Create folder with version number - by Logi - 11-20-2019, 01:33 PM
RE: Create folder with version number - by Kevin - 10-01-2024, 01:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)