Monday, December 5, 2005

1463.aspx

How to get detailed file information using VB Script

The script I posted yesterday showed how to get the size files using FileSystemObject. Windows Explorer displays a lot more information like the Dimensions of photos, Audio bit rates of audio files etc. The Shell.Application object can be used to extract the following information: Album Title, Artist, Attributes, Author, Bit Rate, Camera Model, Category, Comments, Company, Copyright, Date Accessed, Date Created, Date Modified, Date Picture Taken, Description, Dimensions, Duration, File Version, Genre, Name, Owner, Pages, Product Name, Product Version, Protected, Size, Status, Subject, Title, Track Number, Type, Year


The GetDetailsOf() method gets one of the properties above. They are extracted using an ID from 0 to 34. The following script from Microsoft Technet gets the name of each property and then looks up the values for all files in the c:\temp directory. 


' Get the name of the different properties
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
For i = 0 to 34
    arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
' Display the properties and their values for each file
For Each strFileName in objFolder.Items
    For i = 0 to 34
        Wscript.Echo i & vbtab & arrHeaders(i) _
            & ": " & objFolder.GetDetailsOf(strFileName, i)
    Next
Next

The Windows Image Acquisition Automation Library v2.0 can be used if you need basic image acquisition and manipulation functionality.

1 comment:

  1. Hello. I'd like to know if it is possible to WRITE the information abtained with the getDetailsOf





    Thanks..Leo

    ReplyDelete