Jump to content

Movie udf, Just like Sound


ludocus
 Share

Recommended Posts

Hi,

This udf works (almost) the same as Sound udf there is just a slight change in the mcisendstring

have a look:

the udf:

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

 AutoIt Version: 3.2.11.7 (beta)
 Author:         ludocus

 Script Function:
    Template AutoIt script.

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

; Script Start - Add your code below here
Func mciSendString($string)
    Local $iRet
    $iRet = DllCall("winmm.dll", "int", "mciSendStringA", "str", $string, "str", "", "int", 65534, "hwnd", 0)
    If Not @error Then Return $iRet[2]
EndFunc   ;==>mciSendString

Func _MovieOpen($pFile, $pHwnd, $pTop, $pLeft, $pWidth, $pHeight, $pAlias='')
    if $pAlias = '' then $pAlias = RandomStr(10)
    mciSendString("close "&$pAlias)
    if Not @error Then
        mciSendString("open " & FileGetShortName($pFile) & " alias "&$pAlias)
        mciSendString("window "&$pAlias&" handle " & Number($pHwnd))
        mciSendString("put "&$pAlias&" destination at "&$pTop&' '&$pLeft&' '&$pWidth&' '&$pHeight)
        return $pAlias
    Else
        return 0
    EndIf
EndFunc

func _MovieClose($hAlias)
    return mciSendString("close "&$hAlias)
EndFunc

func _MoviePause($rAlias)
    return mciSendString("pause "&$rAlias)
EndFunc

func _MovieStop($jAlias)
    return mciSendString("seek " &$jAlias& " to start")
EndFunc


func _MoviePlay($sAlias)
    mciSendString("set Test_Video time format milliseconds")
    If mciSendString("status "&$sAlias&" position") = mciSendString("status "&$sAlias&" length") Then mciSendString("seek "&$sAlias&" to start")
    mciSendString("play "&$sAlias)
    return 1
EndFunc

func _MoviePos($tAlias)
    $sReturn = mciSendString("status "&$tAlias&" position")
    if @error then return 0
    return $sReturn
EndFunc

func _MovieLength($tAlias)
    $tReturn = mciSendString("status "&$tAlias&" length")
    if @error then return 0
    return $tReturn
EndFunc

func _MovieSeek($sSnd_id, $iHour, $iMin, $iSec)
    Local $iMs = 0
    Local $iRet
    mciSendString("set " & FileGetShortName($sSnd_id) & " time format miliseconds")
    $iMs += $iSec * 1000
    $iMs += $iMin * 60 * 1000
    $iMs += $iHour * 60 * 60 * 1000
    $iRet = mciSendString("seek " &$sSnd_id& " to " & $iMs)
    If $iRet = 0 Then
        Return 1
    Else
        Return SetError(1, 0, 0)
    EndIf
EndFunc

func _MovieStatus($kAlias)
    Return mciSendString("status "&$kAlias&" mode")
EndFunc


Func RandomStr($len)
    Local $string
    For $iCurrentPos = 1 To $len
        $string &= Chr(Random(97, 122, 1))
    Next
    Return $string
EndFunc

Enjoy!

Edited by ludocus
Link to comment
Share on other sites

  • 6 months later...

Which video formats does it support?

Well, I ran it with some videos that where inside my computer. I suppose that plain avi, windows media, divx, and some avi I have no idea how they where generated.

But I also believe that it only runs the kind of movies your PC supports, (codecs). I suggest you try it.

Link to comment
Share on other sites

Well, I ran it with some videos that where inside my computer. I suppose that plain avi, windows media, divx, and some avi I have no idea how they where generated.

But I also believe that it only runs the kind of movies your PC supports, (codecs). I suggest you try it.

I know how to fix it.. but im not really doing autoit at the moment.. so you'll have to wait..
Link to comment
Share on other sites

I know how to fix it.. but im not really doing autoit at the moment.. so you'll have to wait..

Hi Ludocus, I didn't find any problems. I meant that with all kind of videos I tried (that where at hand), they worked OK...

And I meant that most of them I don't know how they where generated, as an ".avi" movie can be a divx, etc., etc. generated movie.

On other hand, the standard guiCtrlCreateavi didn't work on almost all videos I tested (same of above).

Your's it a great udf... simple, efficient and straight to the point.

Jose

Link to comment
Share on other sites

  • 2 years later...

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...