Using VBscript to change extract the "Contributing Artists" information from a WMA file

Based on give WMA file (pls rename 03 Mickey.myyapp to 03 Mickey.wma)
Given this WMA (Window Media Audio) file has information about Singer, Album etc.

(under Window7 or above)

I want a VBscript to :

1) extract the information of "Contributing Artists"
2) Add the information from (1) as the prefix to the file name

If you are including any library object, please also advise how to download the library and how to install the library.

Thank you,

Who is Participating?
omgangConnect With a Mentor IT ManagerCommented:
The original script had

For i = 0 To 300

You should change it back to that.  I changed it to 13 for testing with the WScript.Echo uncommented.
OM Gang
omgangIT ManagerCommented:
This should do it.  I modified the vbscript function found here

OM Gang

Option Explicit

Dim sFilePath, sProgram, sContribArt, sNewName

Set FSO = CreateObject("Scripting.FileSystemObject")

sFilePath = "c:\test3"
sProgram = "03-Mickey.wma"

sContribArt = GetContribArt(sFilePath, sProgram)

      'rename the file
sNewName = sContribArt & "_" & sProgram
FSO.MoveFile sFilePath & "\" & sProgram, sFilePath & "\" & sNewName

Function GetContribArt (sFilePath, sProgram)
Dim FSO, objShell, objFolder, objFolderItem, i

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(sFilePath)
    Set objFolderItem = objFolder.ParseName(sProgram)
    Dim arrHeaders(300)
    For i = 0 To 13
        arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
        'WScript.Echo i &"- " & arrHeaders(i) & ": " & objFolder.GetDetailsOf(objFolderItem, i)
        If lcase(arrHeaders(i))= "contributing artists" Then
            GetContribArt = objFolder.GetDetailsOf(objFolderItem, i)
            Exit For
        End If

End Function
tindavidAuthor Commented:
Great solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.