Jump to content

Enhancement to playing Video Files also


nobbe
 Share

Recommended Posts

hi

Autoit 3.2.2

in module "Sound.au3" i added a few lines to play differnet fileformat too and video (original code didnt display video output on my machine )

Func _SoundOpen($hFile, $sAlias = "")
    ;Declare variables
    Local $sSnd_id, $iCurrentPos, $iRet
    
    
    ;check for file
    If Not FileExists($hFile) Then Return SetError(2, 0, 0)
    ;search for whitespace by character
    For $iCurrentPos = 1 To StringLen($sAlias)
        If StringIsSpace(StringMid($sAlias, $iCurrentPos, 1)) Then Return SetError(3, 0, 0)
    Next
    ;create random alias if one is not supplied
    If $sAlias = "" Then
        $sSnd_id = RandomStr(10)
    Else
        $sSnd_id = $sAlias
    EndIf


    ;
    ; for opening other files as well (AVI, MUS, DIVX)  
    ;
    ; MUS = MPEG 1 Layer2 audio file format for Broadcast Station (DAB) etc .. 
    ;

    If StringInStr(FileGetShortName($hFile), ".MUS") > 0  Or StringInStr(FileGetShortName($hFile), ".AVI") Or StringInStr(FileGetShortName($hFile), ".DIVX") Then
        $iRet = mciSendString("open " & FileGetShortName($hFile) & " type MPEGVideo alias " & $sSnd_id)
    Else
        $iRet = mciSendString("open " & FileGetShortName($hFile) & " alias " & $sSnd_id)
    EndIf
    ; --- end enhancement 



    Return SetError(0, $iRet, $sSnd_id)
EndFunc   ;==>_SoundOpen
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...