Jump to content

File Properties


Recommended Posts

Go to your Excel.exe file, right click and select properties.

Click on the Details tab.

You will see:

File description Microsoft Office Excel

Type Application

File version 12.0.6514.5000

Product name 2007 Microsoft Office System

Product version 12.0.6514.0

Copyright 2006 Mic...

Size 17.4 MB

Date modified 8/17/2009 10:48 PM

Language Language Neutral

How do I get those attributes using a script?? (Mainly wanting Product Name and Product Version, can get file version using FileGetVersion function.)

I've tried using CIM_DataFile in winmgmts, but those aren't in there - or I don't know the right syntax to use.

The FileProperty UDF and it's GetExtProperty doesn't pull them - or I don't know the right number to use.

Right now I am using :

Func GetFileInfo($Filepath)
    ; rebuild path from remote path for query purposes
    $ct = StringInStr($Filepath, "\", 0, 3)
    $Filepath = StringTrimLeft($Filepath, $ct)
    $Filepath = StringReplace($Filepath, "\", "\\")
    $Filepath = StringReplace($Filepath, "c$", "C:")
    ; <---- rebuild path for query

    $objWMIService = ObjGet("winmgmts:\\" & $strPCName & "\root\cimv2")
    $WQLquery = "Select * from CIM_DataFile Where Name = '" & $Filepath & "'"

    ;MsgBox(0,"Query",$WQLquery) ; - checking the query

    $ofileinfo = $objWMIService.ExecQuery($WQLquery)
    If @error Then
        MsgBox(0, "WMI Error", "Error on objget $oWMI")
    EndIf
    For $ofile In $ofileinfo
        $FileDesc = $ofile.Description
        $FileCap = $ofile.Caption
        $Filever = $ofile.Version
        $Filesize = $ofile.FileSize
        $Filemod = $ofile.LastModified
        $FileCreated = $ofile.CreationDate
        $FileAccess = $ofile.LastAccessed
        MsgBox(0, "File Info", $FileDesc & @CRLF & $FileCap & @CRLF & $Filever & @CRLF & $Filesize & @CRLF & $Filemod & @CRLF & $FileCreated & @CRLF & $FileAccess)
    Next
EndFunc   ;==>GetFileInfo

Resulting in:

c:\program files\microsoft office\office11\excel.exe

c:\program files\microsoft office\office11\excel.exe

11.0.8316

10352448

20091008144442.000000-300

20091008144442.000000-300

20100204090123.861704-360

and

$Office = _GetExtProperty($file, 33)
$Product = _GetExtProperty($file, 31)
$Version = FileGetVersion($file)
$Results = $Results & "Outlook," & $Product & "," & $Version & @CRLF

$Office is showing up as "Excel"

$Product is showing "0"

$Version is showing like "11.0.8316.0"

Link to comment
Share on other sites

Wow, these things get buried quick.

I think there was a UDF or snippit posted that would pull lots of file info and put it into a 2d array. I swear I used it in some script, but can't find it again.

The WMI stuff I've found seems to be very limited - or restricted to what info it pulls. I did find FileSystemFile, but it seems to only be through Configuration Manager???

Edited by Graywalker
Link to comment
Share on other sites

  • Moderators

Graywalker,

I have used code like this to successfully read file properties in XP and Vista:

; Object code modified from original by Simulcal & PsaltyDS

Func _Read_File_Properties($sPassed_File_Name)

    Local  $iError = 0
    
    Local $sDir_Name = StringRegExpReplace($sPassed_File_Name, "(^.*\\)(.*)", "\1")
    Local $sFile_Name = StringRegExpReplace($sPassed_File_Name, "^.*\\", "")

    Local $sDOS_Dir = FileGetShortName($sDir_Name, 1)

    Local $oShellApp = ObjCreate("shell.application")
    If IsObj($oShellApp) Then
        Local $oDir = $oShellApp.NameSpace($sDOS_Dir)
        If IsObj($oDir) Then
            Local $oFile = $oDir.Parsename($sFile_Name)
            If IsObj($oFile) Then

                $sFile_Property = $oDir.GetDetailsOf($oFile, ##) ; Insert number for property required

            Else
                $iError = 3
            EndIf
        Else
            $iError = 2
        EndIf
    Else
        $iError = 1
    EndIf

    If $iError > 0 Then
        Local $sMsg = "Could not read File Properties" & @CRLF & @CRLF & _
                $iError & @CRLF & @CRLF & $sPassed_File_Name
        MsgBox(0, "Error", $sMsg)
    EndIf

EndFunc   ;==>_Read_File_Properties

The necessary property codes are as follows (according to t'InterWeb):

;Attribute tables 
; 
;Windows XP 
;Windows Server 2003    Windows 2000  
;------------------------------------------- 
;0 Name         Name  
;1 Size         Size  
;2 Type         Type  
;3 Date Modified    Date Modified  
;4 Date Created     Attributes  
;5 Date Accessed    Comment  
;6 Attributes       Date Created  
;7 Status       Date Accessed  
;8 Owner        Owner  
;9 Author       ???  
;10 Title       Author  
;11 Subject         Title  
;12 Category        Subject  
;13 Pages       Category  
;14 Comments        Pages  
;15 Copyright       Copyright  
;16 Artist      Company Name  
;17 Album Title     Module Desription  
;18 Year        Module Version  
;19 Track Number    Product Name  
;20 Genre       Product Version  
;21 Duration        Sender Name  
;22 Bit Rate        Recipient Name  
;23 Protected       Recipient Number  
;24 Camera Model    Csid  
;25 Date Picture Taken  Tsid  
;26 Dimensions      Transmission Time  
;27 ???         Caller Id  
;28 ???         Routing  
;29 Episode Name    Audio Format  
;30 Program Description Sample Rate  
;31 Description     Audio Sample Size  
;32 Audio sample size   Channels  
;33 Audio sample rate   Play Length  
;34 Channels        Frame Count  
;35 Company     Frame Rate  
;36 Description     Video Sample Size  
;37 File Version    Video Compression  
;38 Product Name    ??? 
;39 Product Version ??? 
;40 Keywords (XP only)  ??? 
; 
; 
;Windows Vista 
;-----------------------
;  0 Name 
;  1 Size 
;  2 Type 
;  3 Date modified
;  4 Date created 
;  5 Date accessed 
;  6 Attributes         
;  7 Offline status 
;  8 Offline availability 
;  9 Perceived type 
; 10 Owner 
; 11 Kinds 
; 12 Date taken 
; 13 Artists 
; 14 Album 
; 15 Year 
; 16 Genre 
; 17 Conductors 
; 18 Tags 
; 19 Rating 
; 20 Authors 
; 21 Title 
; 22 Subject 
; 23 Categories 
; 24 Comments 
; 25 Copyright 
; 26 # 
; 27 Length 
; 28 Bit rate 
; 29 Protected 
; 30 Camera model 
; 31 Dimensions 
; 32 Camera maker 
; 33 Company 
; 34 File description 
; 35 Program name 
; 36 Duration 
; 37 Is online 
; 38 Is recurring 
; 39 Location 
; 40 Optional attendee addresses 
; 41 Optional attendees 
; 42 Organizer address 
; 43 Organizer name 
; 44 Reminder time 
; 45 Required attendee addresses 
; 46 Required attendees 
; 47 Resources 
; 48 Free/busy status 
; 49 Total size 
; 50 Account name 
; 51 Computer 
; 52 Anniversary 
; 53 Assistant's name 
; 54 Assistant's phone 
; 55 Birthday 
; 56 Business address 
; 57 Business city 
; 58 Business country/region 
; 59 Business P.O. box 
; 60 Business postal code 
; 61 Business state or province 
; 62 Business street 
; 63 Business fax 
; 64 Business home page 
; 65 Business phone 
; 66 Callback number 
; 67 Car phone 
; 68 Children 
; 69 Company main phone 
; 70 Department 
; 71 E-mail Address 
; 72 E-mail2 
; 73 E-mail3 
; 74 E-mail list 
; 75 E-mail display name 
; 76 File as 
; 77 First name 
; 78 Full name 
; 79 Gender 
; 80 Given name 
; 81 Hobbies 
; 82 Home address 
; 83 Home city 
; 84 Home country/region 
; 85 Home P.O. box 
; 86 Home postal code 
; 87 Home state or province 
; 88 Home street 
; 89 Home fax 
; 90 Home phone 
; 91 IM addresses 
; 92 Initials 
; 93 Job title 
; 94 Label 
; 95 Last name 
; 96 Mailing address 
; 97 Middle name 
; 98 Cell phone 
; 99 Nickname 
;100 Office location 
;101 Other address 
;102 Other city 
;103 Other country/region 
;104 Other P.O. box 
;105 Other postal code 
;106 Other state or province 
;107 Other street 
;108 Pager 
;109 Personal title 
;110 City 
;111 Country/region 
;112 P.O. box 
;113 Postal code 
;114 State or province 
;115 Street 
;116 Primary e-mail 
;117 Primary phone 
;118 Profession 
;119 Spouse 
;120 Suffix 
;121 TTY/TTD phone 
;122 Telex 
;123 Webpage 
;124 Status 
;125 Content type 
;126 Date acquired 
;127 Date archived 

;Windows 7 
;------------------------------------------------ 
;  0 Name 
;  1 Size 
;  2 Item type 
;  3 Date modified 
;  4 Date created 
;  5 Date accessed 
;  6 Attributes 
;  7 Offline status 
;  8 Offline availability 
; 10 Owner 
; 11 Kind 
; 12 Date taken 
; 13 Contributing artists 
; 14 Album 
; 15 Year 
; 16 Genre 
; 17 Conductors 
; 18 Tags 
; 19 Rating 
; 20 Authors 
; 21 Title 
; 22 Subject 
; 23 Categories 
; 24 Comments 
; 25 Copyright 
; 26 # 
; 27 Length 
; 28 Bit rate 
; 29 Protected 
; 30 Camera model 
; 31 Dimensions 
; 32 Camera maker 
; 33 Company 
; 34 File description 
; 35 Program name 
; 36 Duration 
; 37 Is online 
; 38 Is recurring 
; 39 Location 
; 40 Optional attendee addresses 
; 41 Optional attendees 
; 42 Organizer address 
; 43 Organizer name 
; 44 Reminder time 
; 45 Required attendee addresses 
; 46 Required attendees 
; 47 Resources 
; 48 Meeting status 
; 49 Free/busy status 
; 50 Total size 
; 51 Account name 
; 52 Task status 
; 53 Computer 
; 54 Anniversary 
; 55 Assistant's name 
; 56 Assistant's phone 
; 57 Birthday 
; 58 Business address 
; 59 Business city 
; 60 Business country/region 
; 61 Business P.O. box 
; 62 Business postal code 
; 63 Business state or province 
; 64 Business street 
; 65 Business fax 
; 66 Business home page 
; 67 Business phone 
; 68 Callback number 
; 69 Car phone 
; 70 Children 
; 71 Company main phone 
; 72 Department 
; 73 E-mail address 
; 74 E-mail2 
; 75 E-mail3 
; 76 E-mail list 
; 77 E-mail display name 
; 78 File as 
; 79 First name 
; 80 Full name 
; 81 Gender 
; 82 Given name 
; 83 Hobbies 
; 84 Home address 
; 85 Home city 
; 86 Home country/region 
; 87 Home P.O. box 
; 88 Home postal code 
; 89 Home state or province 
; 90 Home street 
; 91 Home fax 
; 92 Home phone 
; 93 IM addresses 
; 94 Initials 
; 95 Job title 
; 96 Label 
; 97 Last name 
; 98 Mailing address 
; 99 Middle name 
;100 Cell phone 
;101 Nickname 
;102 Office location 
;103 Other address 
;104 Other city 
;105 Other country/region 
;106 Other P.O. box 
;107 Other postal code 
;108 Other state or province 
;109 Other street 
;110 Pager 
;111 Personal title 
;112 City 
;113 Country/region 
;114 P.O. box 
;115 Postal code 
;116 State or province 
;117 Street 
;118 Primary e-mail 
;119 Primary phone 
;120 Profession 
;121 Spouse/Partner 
;122 Suffix 
;123 TTY/TTD phone 
;124 Telex 
;125 Webpage 
;126 Content status 
;127 Content type 
;128 Date acquired 
;129 Date archived 
;130 Date completed 
;131 Device category 
;132 Connected 
;133 Discovery method 
;134 Friendly name 
;135 Local computer 
;136 Manufacturer 
;137 Model 
;138 Paired 
;139 Classification 
;140 Status 
;141 Client ID 
;142 Contributors 
;143 Content created 
;144 Last printed 
;145 Date last saved 
;146 Division 
;147 Document ID 
;148 Pages 
;149 Slides 
;150 Total editing time 
;151 Word count 
;152 Due date 
;153 End date 
;154 File count 
;155 Filename 
;156 File version 
;157 Flag color 
;158 Flag status 
;159 Space free 
;160 Bit depth 
;161 Horizontal resolution 
;162 Width 
;163 Vertical resolution 
;164 Height 
;165 Importance 
;166 Is attachment 
;167 Is deleted 
;168 Encryption status 
;169 Has flag 
;170 Is completed 
;171 Incomplete 
;172 Read status 
;173 Creators 
;174 Date 
;175 Folder name 
;176 Folder path 
;177 Folder 
;178 Participants 
;179 Path 
;180 By location 
;181 Type 
;182 Contact names 
;183 Entry type 
;184 Language 
;185 Date visited 
;186 Description 
;187 Link status 
;188 Link target 
;189 URL 
;190 Media created 
;191 Date released 
;192 Encoded by 
;193 Producers 
;194 Publisher 
;195 Subtitle 
;196 User web URL 
;197 Writers 
;198 Attachments 
;199 Bcc addresses 
;200 Bcc 
;201 Cc addresses 
;202 Cc 
;203 Conversation ID 
;204 Date received 
;205 Date sent 
;206 From addresses 
;207 From 
;208 Has attachments 
;209 Sender address 
;210 Sender name 
;211 Store 
;212 To addresses 
;213 To do title 
;214 To 
;215 Mileage 
;216 Album artist 
;217 Album ID 
;218 Beats-per-minute 
;219 Composers 
;220 Initial key 
;221 Part of a compilation 
;222 Mood 
;223 Part of set 
;224 Period 
;225 Color 
;226 Parental rating 
;227 Parental rating reason 
;228 Space used 
;229 EXIF version 
;230 Event 
;231 Exposure bias 
;232 Exposure program 
;233 Exposure time 
;234 F-stop 
;235 Flash mode 
;236 Focal length 
;237 35mm focal length 
;238 ISO speed 
;239 Lens maker 
;240 Lens model 
;241 Light source 
;242 Max aperture 
;243 Metering mode 
;244 Orientation 
;245 People 
;246 Program mode 
;247 Saturation 
;248 Subject distance 
;249 White balance 
;250 Priority 
;251 Project 
;252 Channel number 
;253 Episode name 
;254 Closed captioning 
;255 Rerun 
;256 SAP 
;257 Broadcast date 
;258 Program description 
;259 Recording time 
;260 Station call sign 
;261 Station name 
;262 Summary 
;263 Snippets 
;264 Auto summary 
;265 Search ranking 
;266 Sensitivity 
 
;128 Date completed 
;129 Date imported 
;130 Client ID 
;131 Contributors 
;132 Content created 
;133 Last printed 
;134 Date last saved 
;135 Division 
;136 Document ID 
;137 Pages 
;138 Slides 
;139 Total editing time 
;140 Word count 
;141 Due date 
;142 End date 
;143 File count 
;144 Filename 
;145 File version 
;146 Flag color 
;147 Flag status 
;148 Space free 
;149 Bit depth 
;150 Horizontal resolution 
;151 Width 
;152 Vertical resolution 
;153 Height 
;154 Importance 
;155 Is attachment 
;156 Is deleted 
;157 Has flag 
;158 Is completed 
;159 Incomplete 
;160 Read status 
;161 Shared 
;162 Creator 
;163 Date 
;164 Folder name 
;165 Folder path 
;166 Folder 
;167 Participants 
;168 Path 
;169 Contact names 
;170 Entry type 
;171 Language 
;172 Date visited 
;173 Description 
;174 Link status 
;175 Link target 
;176 URL 
;177 Media created 
;178 Date released 
;179 Encoded by 
;180 Producers 
;181 Publisher 
;182 Subtitle 
;183 User web URL 
;184 Writers 
;185 Attachments 
;186 Bcc addresses 
;187 Bcc names 
;188 Cc addresses 
;189 Cc names 
;190 Conversation ID 
;191 Date received 
;192 Date sent 
;193 From addresses 
;194 From names 
;195 Has attachments 
;196 Sender address 
;197 Sender name 
;198 Store 
;199 To addresses 
;200 To do title 
;201 To names 
;202 Mileage 
;203 Album artist 
;204 Beats-per-minute 
;205 Composers 
;206 Initial key 
;207 Mood 
;208 Part of set 
;209 Period 
;210 Color 
;211 Parental rating 
;212 Parental rating reason 
;213 Space used 
;214 EXIF version 
;215 Event 
;216 Exposure bias 
;217 Exposure program 
;218 Exposure time 
;219 F-stop 
;220 Flash mode 
;221 Focal length 
;222 35mm focal length 
;223 ISO speed 
;224 Lens maker 
;225 Lens model 
;226 Light source 
;227 Max aperture 
;228 Metering mode 
;229 Orientation 
;230 Program mode 
;231 Saturation 
;232 Subject distance 
;233 White balance 
;234 Priority 
;235 Project 
;236 Channel number 
;237 Episode name 
;238 Closed captioning 
;239 Rerun 
;240 SAP 
;241 Broadcast date 
;242 Program description 
;243 Recording time 
;244 Station call sign 
;245 Station name 
;246 Auto summary 
;247 Summary 
;248 Search ranking 
;249 Sensitivity 
;250 Shared with 
;251 Product name 
;252 Product version 
;253 Source 
;254 Start date 
;255 Billing information 
;256 Complete 
;257 Task owner 
;258 Total file size 
;259 Legal trademarks 
;260 Video compression 
;261 Directors 
;262 Data rate 
;263 Frame height 
;264 Frame rate 
;265 Frame width 
;266 Total bitrate

I hope this helps! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

I hope this helps! :D

Yes, it DID! Thank you!

So, what I did was :

For $i = 0 To 266
$properties = _GetExtProperty($file, $i)
$Results = $Results & $i & " : " & $properties & @CRLF
Next
FileWrite($LogFile, $strPCName & @CRLF & $Results)

Which tells me that Product Name is under 263 and Product Verison is 264.

0 Name              0 : EXCEL.EXE
1 Size                      1 : 9.87 MB
 2 Item type                2 : Application
 3 Date modified        3 : 10/8/2009 1:44 PM
 4 Date created         4 : 10/8/2009 1:44 PM
 5 Date accessed        5 : 2/5/2010 8:48 AM
 6 Attributes               6 : A
 7 Offline status       7 : Online
 8 Offline availability     8 : Not available
9 Type                      9 : Application
10 Owner               10 : Administrators
11 Kind                11 : Program
19 Rating              19 : Unrated
25 Copyright               25 : Copyright © 1985-2003 Microsoft Corporation.  All rights reserved.
33 Company             33 : Microsoft Corporation
34 File description            34 : Microsoft Office Excel
63 Business state or province  63 : !ComputerName!
155 Filename              155 : EXCEL.EXE
156 File version          156 : 11.0.8316.0
165 Importance            165 : Normal
176 Folder path           176 : OFFICE11
177 Folder            177 : \\!ComputerName!\c$\Program Files\Microsoft Office\OFFICE11
178 Participants          178 : OFFICE11 (\\!ComputerName!\c$\Program Files\Microsoft Office)
180 By location           180 : \\!ComputerName!\c$\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE
183 Entry type            183 : Language Neutral
186 Description           186 : Unresolved
263 Snippets              263 : Microsoft Office 2003
264 Auto summary          264 : 11.0.8316.0

So, for anyone who wants to pull the file info - use that loop to find what attribute numbers you need!! They probably go past 266... ?? :huggles:

Link to comment
Share on other sites

  • Moderators

Graywalker,

Glad I could help! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • 8 months later...

Hi, Both the fact that no ones been active on this topic for a long time and my question are a long shot.

I just wanted to know if anyone knows anything about getting extended file properties from a file located on a network? Is it even possible, because I'm trying and I am just getting COM errors?

So if anyone knows anything can you please let me know as soon as possible!

Thanks

Link to comment
Share on other sites

  • 1 year later...

Hi Melba,

i am using the script you have posted on #5 and i am trying to get the product version of my anti virus application. but it just returns the value 0. i am using Windows 7 64 bit machine. even i have tried it in XP machine it returns the value 0 for me.

the values i used is,

XP - 39

W7 - 252( also i tried 264,264) nothing helped out ... :)

Any suggestion for me ?

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Any suggestion for me ?

Loop through all the properties and see if you can pick out the one you need. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

See if this function works for you, it searches for the file property by its name, rather than by its number.

Func _FileGetProperty(Const $S_PATH, Const $S_PROPERTY = "") ; Function used to get file properties that can't be read from the file tags.
    Local Const $objShell = ObjCreate("Shell.Application")
    If Not FileExists($S_PATH) Then Return SetError(1, 0, 0)
    Local Const $S_FILE = StringTrimLeft($S_PATH, StringInStr($S_PATH, "", 0, -1))
    Local Const $S_DIR = StringTrimRight($S_PATH, StringLen($S_FILE) + 1)
    If @error Then Return SetError(3, 0, 0)
    Local Const $objFolder = $objShell.NameSpace($S_DIR)
    Local Const $objFolderItem = $objFolder.Parsename($S_FILE)
    If $S_PROPERTY Then
        For $I = 0 To 300
            If $objFolder.GetDetailsOf($objFolder.Items, $I) = $S_PROPERTY Then Return $objFolder.GetDetailsOf($objFolderItem, $I)
        Next
        Return SetError(2, 0, 0)
    EndIf
    Local $av_ret[1][2] = [[1]]
    For $I = 0 To 300
        If $objFolder.GetDetailsOf($objFolder.Items, $I) Then
            ReDim $av_ret[$av_ret[0][0] + 1][2]
            $av_ret[$av_ret[0][0]][0] = $objFolder.GetDetailsOf($objFolder.Items, $I)
            $av_ret[$av_ret[0][0]][1] = $objFolder.GetDetailsOf($objFolderItem, $I)
            $av_ret[0][0] += 1
        EndIf
    Next
    If Not $av_ret[1][0] Then Return SetError(2, 0, 0)
    $av_ret[0][0] -= 1
    Return $av_ret
EndFunc   ;==>_FileGetProperty

I found this function somewhere on the forums here and can't remember who originally wrote it, but it works well if you know the property name you're looking for. The names are different depending upon the version of Windows you're using.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...