vbscript >> Changing Extended File properties

by VkhH » Fri, 21 Apr 2006 00:52:02 GMT

In VBScript I can use the command "GetDetailsOf" to acquire all properties of
a particular file (35 properties are listed). I want to know if there is a
VBA script method or command I can use to change these properties of a file.
I would like to alter some of the properties of mp3 file (e.g. property
"album" or "genre") so I can create new groups based on my own division
parameters.

Kind regards,


Gilbert Van Hauwe


vbscript >> Changing Extended File properties

by Ziminski » Fri, 21 Apr 2006 06:39:11 GMT


take a look at objFile.Attributes


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\FSO\TestScript.vbs")

If objFile.Attributes = objFile.Attributes AND 1 Then
objFile.Attributes = objFile.Attributes XOR 1
End If

On Thu, 20 Apr 2006 09:52:02 -0700, VHG

vbscript >> Changing Extended File properties

by Michael Harris (MVP) » Fri, 21 Apr 2006 11:33:27 GMT


Unfortunately the Shell.Automation object model does not expose any
SetDetailsOf counterpart of GetDetailsOf and I know of no other scriptable
way to do so. Many people have asked over the years to no avail.


--
Michael Harris
Microsoft MVP Scripting

Similar Threads

1. Change the 'Extend my windows desktop...' property - VB.Net

2. Getting Extended File Properties

I need to obtain the extended file properties, such as Owner, Title, etc, 
for a file in a .net program.  I have looked through the FileInfo class and 
I cannot see any methods or properties that will expose this.  In the old 
days we used to use GetFileInfo but I don't see it in .Net anywhere.

How can I get this information?
Thanks,
T 


3. Reading/Writing Extended File Properties - VB.Net

4. Extended file properties

I have searched the forum for tips on how to get extended file
properties, but haven't had any luck yet.  What I'm after specifically
is version information, such as that found when a file is
right-clicked in Windows Explorer, then under the Version tab.  The
number given for Product Version would be perfect.  I need to get this
information using only VBScript if possible.  I know about
GetDetailsOf, but have not been able to get that to give me version. 
It may be that what I'm trying to do is not possible.
Also, is there a list somewhere that shows all the columns available
with GetDetailsOf?  I saw a page at Microsoft that only had 4 or 5,
but I've seen some code that went up to 33 or so.  Thanks in advance
for any help.

5. Missing extended file properties

6. Extended File Properties

Hi,

Using some code I found on the web I can read the Extended file properties.

Some of the properties are clearly read only, but how can I change the 
ones which aren't?

<code>
Function GetFileInformation() As Boolean
On Error GoTo ErrorHandler
Dim arrHeaders(35)
   Set objShell = CreateObject("Shell.Application")
   Set objfolder = objShell.Namespace("C:\TestFolder")
   For i = 0 To 34
    arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i)
   Next
   For Each strFileName In objfolder.Items
    For i = 0 To 34
    Debug.Print i & vbTab & arrHeaders(i) & ": " _
           & objfolder.GetDetailsOf(strFileName, i)
    Next
   Next
   GetFileInformation = True
   Exit Function
ErrorHandler:
   MsgBox "Unable to process data in Function 'GetFileInformation' due 
to:" & vbCrLf & Err.Description, vbCritical
   Err.Clear
   GetFileInformation = False
End Function  ' GetFileInformation
</code>


Regards


Laurie Comerford

7. Edit extended AVI properties of media file "details" in VB.NET

8. set text file extended property

Is it possible to alter the extended (text) file properties, such as Title 
and Comments in code?
Had a long search for this, but not found anything at all.
There is no problem reading these properties:

Function GetFileProperty(vFolder As Variant, _
                         strFile As String, _
                         Optional lIndex As Long, _
                         Optional strItemName As String) As String

  Dim i As Long
  Dim objShell As Object
  Dim objFolder As Object
  Dim objFolderItem As Object
  Dim arrHeaders(41)

  Set objShell = CreateObject("Shell.Application")
  Set objFolder = objShell.Namespace(vFolder)
  Set objFolderItem = objFolder.ParseName(strFile)

  If Len(strItemName) > 0 Then
    For i = 0 To 40
      arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
      If arrHeaders(i) = strItemName Then
        lIndex = i
        Exit For
      End If
    Next
  End If

  GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Sub test()
  MsgBox GetFileProperty("C:\test\", "test.txt", , "Comments")
End Sub


If there is no way to set these properties in code then is there another way 
to mark a text file
in such a way that it won't be changed by a save or write of the file?


RBS