Sign in to follow this  
Followers 0

Movie udf, Just like Sound

14 posts in this topic

Posted (edited)

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

Share this post


Link to post
Share on other sites



Posted

Comments are welcome :)

Share this post


Link to post
Share on other sites

Posted

This is awsome....thx ludocus i`ve been w8ing 4 a long time for something like this.....thx again...and keep up the good work !!

Share this post


Link to post
Share on other sites

Posted

no problem.

Lol, i like your avatar :)

Share this post


Link to post
Share on other sites

Posted (edited)

great sofware, Ludocus.

Simple and efficent. I tried with a lot of kind of movies and it worked with all.

Most of them, GUICtrlCreateAvi didnt work...

Thanks

Jose

Edited by joseLB

Share this post


Link to post
Share on other sites

Posted

Which video formats does it support?

Share this post


Link to post
Share on other sites

Posted (edited)

Hi!

Very fun & easy.

Run with many windows (WordPad/Write ; Excel ; Explorer ; etc. etc.)

Don't run inside several windows (notepad, terminal, ...)

A good application of MCI

Thanks, Ludocus.

Edited by Michel Claveau

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

misunderstanding then..

Thnx!

Share this post


Link to post
Share on other sites

Posted

For me, the video is playing too fast, and without sound!!!

Any solution???

Share this post


Link to post
Share on other sites

Posted (edited)

:: Ludocus

Your method is so beautiful.

Thanks a lot.

$sStrA = ycmGet_CryptHASH( $iLinA , $sPathA , "MD5" ) ; I used this instead 'Random String'
Edited by ChangMinYang

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.