Sign in to follow this  
Followers 0
dirty

how to get file product version ?

4 posts in this topic

#1 ·  Posted (edited)

i looked at http://www.autoitscript.com/forum/index.php?showtopic=109450

bit its for XP.

Windows 7 is different so its no help.

http://www.autoitscript.com/forum/index.php?showtopic=25859 does not get product version or fileversion

Isnt there a simpler way to get file information just like FileGetVersion does ?

Kinda like C++ http://msdn.microsoft.com/en-us/library/aa364952%28VS.85%29.aspx ?

I know autoit is not C++, but if FileGetVersion is there then where is the rest ?

I wonder if FileGetVersion is an au3 that can be opened and modified..........

Thanks for help

Edited by dirty

Share this post


Link to post
Share on other sites



It does work for Vista and 7, but the numbers are all moved around.

I've had to go through and poll all the properties to find the number of the property that I want before, then use an @OSVersion switch to make sure and read the correct one.

...though someone else may know of a more reliable way :D


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

dirty,

If you scroll down the list of property numbers that I posted in the second codebox here, you will see that there are also the codes for Vista and Win7.

So for Win 7, Product version = 252 :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$prop = _GetExtProperty($path,252) returns 0

but thanks to you i made this.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=Comment
#AutoIt3Wrapper_Res_Description=Description
#AutoIt3Wrapper_Res_Fileversion=1.1
#AutoIt3Wrapper_Res_LegalCopyright=Copyright
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$OSbit = @OSArch
$OS = @OSVersion
$Form1 = GUICreate("",200,500)
$edit = GUICtrlCreateEdit ("",0,0,200,480)
$button = GUICtrlCreateButton ("search",0,480,200,20)

$path = FileOpenDialog("Find File", @ScriptDir & "\", "All Files (*.*)",1+2)
If $path = "" Then
MsgBox(48,'ERROR',"You need to open file. Exiting now...")
Exit
Else
EndIf
GUISetState(@SW_SHOW)
While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
       Case $GUI_EVENT_CLOSE
           Exit
    Case $button
For $i = 1 To 500
$prop = _GetExtProperty($path,$i)
;Server 2003
If $OS = "WIN_2003" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows Server 2003 #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_2003" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
;XP
ElseIf $OS = "WIN_XP" And $OSbit = "X86" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows XP 32bit #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_XP" And $OSbit = "X86" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
ElseIf $OS = "WIN_XP" And $OSbit = "X64" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows XP 64bit #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_XP" And $OSbit = "X64" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
;Server 2008
ElseIf $OS = "WIN_2008" And $OSbit = "X86" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows Server 2008 32bit #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_2008" And $OSbit = "X86" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
ElseIf $OS = "WIN_2008" And $OSbit = "X64" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows Server 2008 64bit #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_2008" And $OSbit = "X64" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
;Vista Windows 7
ElseIf $OS = "WIN_VISTA" And $OSbit = "X86" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows 7 32bit #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_VISTA" And $OSbit = "X86" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
ElseIf $OS = "WIN_VISTA" And $OSbit = "X64" And $prop > "0" Then
GUICtrlSetData ($edit, "Windows 7 64bit #" & $i & "=" & $prop & @CRLF,"Input")
ElseIf $OS = "WIN_VISTA" And $OSbit = "X64" And $prop = "0" Then
GUICtrlSetData ($edit, "","input")
EndIf
; repeat 500 times
Next
MsgBox(32,'Status','DONE')
   EndSwitch
WEnd
#Region ;This is the function that should not be touched
Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
        SetError(1)
        Return 0
    Else
        $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
        $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
        $oShellApp = ObjCreate ("shell.application")
        $oDir = $oShellApp.NameSpace ($sDir)
        $oFile = $oDir.Parsename ($sFile)
        If $iProp = -1 Then
            Local $aProperty[35]
            For $i = 0 To 34
                $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
            Next
            Return $aProperty
        Else
            $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
            If $sProperty = "" Then
                Return 0
            Else
                Return $sProperty
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_GetExtProperty
#EndRegion

Please someone with Windows 7 32bit or XP 64bit confirm that the following result are same. That way i would know that at least OS architecture has no effect on those numbers. :D

###################

# Windows 7 64bit #

###################

1=Size

2=Type

3=Date Modified

4=Date Created

5=Date Accessed

6=Attributes

10=Owner

11=Kind

16=Genre

18=Tags

19=Rating

20=Authors

22=Subject

25=Copyright

27=Lenght

28=Bit Rate

31=Dimensios

34=Description

35=Program Name

53=Computer

155=Name

156=File Version

160=Bit Depth

161=dpi

162=Width

163=dpi

164=Height

175=Current Folder

176=Folder Path

179=full Path TO File

181=Item Type

184=Language

267=Product Name

268=Product Version

276=Legal Trademarks

279=Data Rate

280=Frame Height

281=FrameRate

282=Frame Width

188=URL

189=URL

283=Total BitRate

####################

# Windows XP 32bit #

####################

1=Size

2=Type

3=Date Modified

4=Date Created

5=Date Accessed

6=Attributes

8=Computer or SID

10=Title

11=Subject

14=COmments

26=Dimensions

27=Width

28=Height

31=Signing Time

35=Company Name

36=Internal Name

37=File Version

38=Product Name

39=Product Version

Edited by dirty

Share this post


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
Sign in to follow this  
Followers 0