Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to read sound file playing time?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tom Lavedas  
View profile  
 More options May 15 2012, 4:40 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Tom Lavedas <tglba...@verizon.net>
Date: Tue, 15 May 2012 13:40:18 -0700 (PDT)
Local: Tues, May 15 2012 4:40 pm
Subject: Re: How to read sound file playing time?
On May 15, 11:51 am, "Dave \"Crash\" Dummy" <inva...@invalid.invalid>
wrote:

> When I list sound files (wave, mp3, etc.) in Explorer, and can select a
> "length" column that shows playing time for the file. Is there some way
> I can retrieve that value for a sound file using script?
> --
> Crash

> "When you get to a fork in the road, take it."
> ~ Yogi Berra ~

The Shell.Application objects .GetDetailsOf() function should work to
return the "length" property ...

wsh.echo FileProperty("C:\users\tlavedas\Documents\Script\Testing\",
"chimes.wav", 27)

function FileProperty(sPath, sFileName, nProperty)
  dim objShell
  set oFldr = CreateObject("Shell.Application").NameSpace(sPath)
  set ofile = oFldr.Parsename(sFilename)
  FileProperty = oFldr.GetDetailsOf(ofile, nProperty)
end function

The value '27' is appropriate for the Length property in Win7.  It is
probably different in WinXP (or not available, since it supports far
fewer).  This script lists the available properties and the
corresponding number in all OS versions ...

sFolderPathspec = createobject("wscript.shell").currentdirectory

Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace(sFolderPathspec)
Dim arrHeaders(286)
i = 0
on error resume next
do
'  redim preserve arrHeaders(i)
  arrHeaders(i) = i & " " & objFolder.GetDetailsOf(objFolder.Items,i)
  i = i + 1
loop until err.number <> 0
on error goto 0

wsh.echo join(arrHeaders, vbcrlf)
________________________________
Tom Lavedas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.