Jump to content
Sign in to follow this  

Maybe a bug in _SoundLength

Recommended Posts


#cs ----------------------------------------------------------------------------

 AutoIt Version:
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Sound.au3>
$var= FileOpenDialog ("Select","","Musica (*.mp3;*.wma;*.wav)",1)

$sound = _SoundOpen($var, "Startup")
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
ElseIf @error = 3 Then
    MsgBox(0, "Error", "The alias was invalid")
ElseIf @extended <> 0 Then
    $extended = @extended;assign because @extended will be set after DllCall
    $stText = DllStructCreate("char[128]")
    $errorstring = DllCall("winmm.dll","short","mciGetErrorStringA","str",$extended,"ptr",DllStructGetPtr($stText),"int",128)
    MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
    MsgBox(0, "Success", "The file opened successfully")
MsgBox(0, "Sound Length", "The Sound has a length of:" & @CRLF & "hh:mm:ss - " & _SoundLength($sound, 1))

for every file (mp3 ect)


Sound Length


The Sound has a length of:

hh:mm:ss - 00:00:00




I think this is a bug of autoIt

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.