Hello,
I have the vbscript below that lists all the mp3 files in the current directory and prints them to an html file. What I am trying to do is get the bitrate and lenght of each file as well. I have tried playing with objDir.GetDetailsOf, but I can't figure out how to make it work with the script I have. RFrom what I have found the attributes I'm after are 27 for length and 28 for bitrate. Any help would be greatly apperciated.
This is what I currently have minus the html.
I have the vbscript below that lists all the mp3 files in the current directory and prints them to an html file. What I am trying to do is get the bitrate and lenght of each file as well. I have tried playing with objDir.GetDetailsOf, but I can't figure out how to make it work with the script I have. RFrom what I have found the attributes I'm after are 27 for length and 28 for bitrate. Any help would be greatly apperciated.
This is what I currently have minus the html.
Code:
Class clsApplication
Property Get Path()
Dim sTmp
If IsObject(WScript) Then
'Windows Scripting Host
Path = left(WScript.ScriptFullName, InStr(WScript.ScriptFullName, WScript.ScriptName) -2)
path = Replace(Path, "\","/" )
End If
End Property
End Class
Dim App : Set App = New clsApplication 'use as App.Path
Dim ls, fsObj, fd, fs, fl, sfs, sf, tf, als, afd, afs, afl, asfs, asf, afsObj
' specify the file extensions to list
dim fileTypes
fileTypes = Array("mp3","flac","mogg","mid","wav")
ls = ""
Set fsObj = CreateObject("Scripting.FileSystemObject")
Set fd = fsObj.GetFolder(".")
Set afsObj = CreateObject("Scripting.FileSystemObject")
Set afd = afsObj.GetFolder(".")
set fs = fd.Files
set afs = afd.Files
' list subfolders
set asfs = afd.SubFolders
For Each asf in asfs
als = als & "<li><a href=""" & asf.name & chr(47) & "index.html" & chr(34) & " class=""focusable""" & Chr(62) & "<img src=""" & asf.name & "/front.jpg"" class=""coverthumb"" alt="""">" & asf.name & "</a></li>" & chr(10)
Next
For Each fl in fs
' check whether the extension matches
if arrayContains(fileTypes, fsObj.GetExtensionName(fl.name))then
ls = ls & "<li><a href=""#""" & " data-src=""" & "file:///" & app.path & "/" & fl.name & chr(34) & " class=""focusable"" data-sn-right=""#prev""" & Chr(62) & "<img src=""" & "file:///" & app.path & "/front.jpg"" " & "class=""coverthumb"" alt="""" " & Chr(62) & fl.name & "</a></li>" & chr(10)
end if
Next
Set tf = fsObj.OpenTextFile("index.html", 2, True, False)
HTML HERE
Set fsObj = Nothing
function arrayContains (arr, val)
dim found
found = false
for i = 0 to ubound(arr)
if arr(i) = val then
found = true
exit for
end if
next
arrayContains = found
end function