Jump to content

_SoundLength


Recommended Posts

_SoundLength just isn't working for me. I did a search, and people recently had this problem, but i read it was fixed. I have the latest version of autoit, not the beta though ( i don't like using beta).

how can i make _SoundLength work?

it just fails.

like if i did this.

_SoundOpen(@DesktopDir & "\Music\1.mp3", $Current)
MsgBox(0, "", _SoundLength($Current, 2))

i also tried doing it this way.

_SoundOpen(@DesktopDir & "\Music\1.mp3", $Current)
$length = _SoundLength($Current, 2)
MsgBox(0, "", "length is " & $length)

but still fail. why is autoit being cruel to me?

yes i am including the Sound.au3

#include <Sound.au3>

and the song path is correct.

and i can play the song with _SoundPlay. just can't get the length.

Edited by Tomb616
Link to comment
Share on other sites

Hello i have the same problem

exemple (_SoundLength no work, but _SoundPos work fine).

#include <Sound.au3>
$sound=_SoundOpen ("C:\fix.wav")
$vor=_SoundLength ($sound, 2)
MsgBox (0,"Time",$vor)

I have the last autoit (Nov 25 2007 09:22:42).

ps: where is the "attached version" here? http://www.autoitscript.com/forum/index.ph...mp;#entry440847

sorry for my bad english

edit: the solution

dowload the beta autoit-v3.2.11.5-sfx.exe, but not install, just extract, move the sound.au3 in the Include directory of the stable autoit. (C:\Program Files\AutoIt3\Include\ by default ) (make a backup of the orginal)

Now all work fine, good job.

http://www.autoitscript.com/autoit3/files/beta/autoit/

Edited by panlatv
Link to comment
Share on other sites

Hello i have the same problem

exemple (_SoundLength no work, but _SoundPos work fine).

#include <Sound.au3>
$sound=_SoundOpen ("C:\fix.wav")
$vor=_SoundLength ($sound, 2)
MsgBox (0,"Time",$vor)

I have the last autoit (Nov 25 2007 09:22:42).

ps: where is the "attached version" here? http://www.autoitscript.com/forum/index.ph...mp;#entry440847

sorry for my bad english

edit: the solution

dowload the beta autoit-v3.2.11.5-sfx.exe, but not install, just extract, move the sound.au3 of the Include directory of the stable autoit. (C:\Program Files\AutoIt3\Include\ by default ) (make a backup of the orginal)

Now all work fine, good job.

http://www.autoitscript.com/autoit3/files/beta/autoit/

Nice work.

can you attach the Sound.au3 for me?

:D

Link to comment
Share on other sites

Here is a way to get the duration of the .mp3 -

$SoundFile = "1.mp3"
$folder = @DesktopDir & "\Music"

;Based on gaFrost's FileExtProperties - kudos to simucal
$objShell = ObjCreate("Shell.Application")
$objFolder = $objShell.Namespace ($folder)
For $strFileName In $objFolder.Items
    If $objFolder.GetDetailsOf ($strFileName, 0) = $SoundFile Then
        $duration = $objFolder.GetDetailsOf ($strFileName, 21)
        ExitLoop
    EndIf
Next
MsgBox(0, "MP3 Duration", $duration)

It is strongly recommended that you do not store folders or files other than shortcuts on the desktop - its a memory hog.

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...