Jump to content

My 1st Autoit Script - A Media Player


ronriel
 Share

Recommended Posts

Your welcome, I've been enjoying playing with your script :whistle:

Added Drag & Drop of file(s) into the List box and also set the your player gui to top most (Makes it easier to drop files from explorer or where ever) :lmao:

In case your interested for the next release

Added below Opt ("WinTitleMatchMode", 4)

Global $WM_DROPFILES = 0x233
Global $gaDropFiles[1]oÝ÷ ØuçDÅ+rë«­¢+ØÀÌØíÕ¤ÄôU%
ÉÑ ÀÌØí@°ÌØÀ°ÈÀÀ°ÔÄÀ°ÄàØ°´Ä°ÀÌØí]M}a}Q=A5=MP¬ÀÌØí]M}a}

AQ%1L¤oÝ÷ Ø]yÖÞ4ߢÝoÝ÷ Ø]yÖÞPµ+ZµäHsÓ~ º-ZºÚ"µÍÕRTYÚÝÙÈ
    ÌÍÕÓWÑÔSTË   ][ÝÕÓWÑÔST×ÑSÉ][ÝÊoÝ÷ Ø]yÛazǶìºw-춨º¹b²Ú~éܶ*'±«­¢+ÙչɽÁ¥±Ì ¤ìɵÀìɽÀµÕÑ¥Á±¥±Ì¥¹Ñ¼Ñ¡1¥Íѽఽ¹±ä¨¹µÀÌ°¨¹ÝØ°¨¹´ÍÔ°¨¹Á±ÌÝ¥±°ì¤(%½ÈÀÌØí¤ôÀQ¼U   ½Õ¹ ÀÌØíɽÁ¥±Ì¤´Ä($%%MÑÉ¥¹I¥¡Ð ÀÌØíɽÁ¥±ÍlÀÌØí¥t°Ð¤ôÌäì¹µÀÌÌäì=ÈMÑÉ¥¹I¥¡Ð ÀÌØíɽÁ¥±ÍlÀÌØí¥t°Ð¤ôÌäì¹ÝØÌäìQ¡¸($$¥±
±½Í¡¥±]ɥѡ¥±=Á¸ ÀÌØí±ÍаĤ°ÀÌØíɽÁ¥±ÍlÀÌØí¥tµÀì
I1¤¤($%±Í%MÑÉ¥¹I¥¡Ð ÀÌØíɽÁ¥±ÍlÀÌØí¥t°Ð¤ôÌäì¹Á±ÌÌäìQ¡¸($$%}¥±IQ½ÉÉä ÀÌØíɽÁ¥±ÍlÀÌØí¥t°ÀÌØíȤ($$$ÀÌØíÍÑÈôMÑÉ¥¹
H¡MÑÉ¥¹MÑÉ¥Á]L¡MÑÉ¥¹IáÁIÁ±¡MÑÉ¥¹IáÁIÁ±¡MÑÉ¥¹IáÁIÁ± }ÉÉåQ½MÑÉ¥¹ ÀÌØíÈ°1°Ì¤°ÅÕ½Ðì  ý¤¤ üéQ¥Ñ±¥lÀ´åuìÄ°Ñô¤ üèô¤¹ìıôÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ð줰ÅÕ½Ðì  ý¤¤ üé1¹Ñ ¥lÀ´åuìÄ°Ñô¤ üèô¤¹ìıôÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ð줰ÅÕ½Ðì  ý¤¤ ü饱¥lÀ´åuìÄ°Ñô¤ üèô¤ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ð줰Ф¤($$¥±
±½Í¡¥±]ɥѡ¥±=Á¸ ÀÌØí±ÍаĤ°ÀÌØíÍÑȤ¤($%±Í%MÑÉ¥¹I¥¡Ð ÀÌØíɽÁ¥±ÍlÀÌØí¥t°Ð¤ôÌäì¹´ÍÔÌäìQ¡¸($$}¥±IQ½ÉÉä ÀÌØíɽÁ¥±ÍlÀÌØí¥t°ÀÌØíȤ($$ÀÌØíÍÑÈôMÑÉ¥¹
H¡MÑÉ¥¹MÑÉ¥Á]L¡MÑÉ¥¹IáÁIÁ±¡}ÉÉåQ½MÑÉ¥¹ ÀÌØíÈ°1°Ì¤°ÅÕ½Ðì  ý¤¤ üèaQ%9¤¤¹ìıôÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ð줰Ф¤(¥±
±½Í¡¥±]ɥѡ¥±=Á¸ ÀÌØí±ÍаĤ°ÀÌØíÍÑȤ¤$$$($%¹%$(%9áÐ(%ÁÉÀ ¤)¹Õ¹()Õ¹]5}I=A%1M}U9 ÀÌØí¡]¹°ÀÌØíµÍ%°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤(%1½°ÀÌØí¹M¥é°ÀÌØíÁ¥±9µ(%1½°ÀÌØí¹µÐô±±
±° ÅÕ½ÐíÍ¡±°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÉEÕÉ奱ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØíÝAÉ´°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°Áá°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÈÔÔ¤(%½ÈÀÌØí¤ôÀQ¼ÀÌØí¹µÑlÁt´Ä($$ÀÌØí¹M¥éô±±
±° ÅÕ½ÐíÍ¡±°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÉEÕÉ奱ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØíÝAÉ´°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¤°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤($$ÀÌØí¹M¥éôÀÌØí¹M¥élÁt¬Ä($$ÀÌØíÁ¥±9µô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¡ÉlÅÕ½ÐìµÀìÀÌØí¹M¥éµÀìÅÕ½ÐítÅÕ½Ðì¤($%±±
±° ÅÕ½ÐíÍ¡±°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÉEÕÉ奱ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØíÝAÉ´°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¤°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØíÁ¥±9µ¤°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¹M¥é¤($%I¥´ÀÌØíɽÁ¥±ÍlÀÌØí¤¬Åt($$ÀÌØíɽÁ¥±ÍlÀÌØí¥tô±±MÑÉÕÑÑÑ ÀÌØíÁ¥±9µ°Ä¤($$ÀÌØíÁ¥±9µôÀ(%9áÐ)¹Õ¹

Shabam.. Drag and Drop file(s) works like a charm (for me anyways) ;)

Cheers

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thanks again smashly.. It's nice to know I'm not the only one enjoying this little script. :whistle:

This function "WM_DROPFILES_FUNC" is very nice. Where can I get more info about those dll calls?

I ought to learn about those calls too. I can be a clever coder but my knowledge in these fields is very limited; limited to what's on the Autoit Help in fact. :lmao:

Keep it coming, I'm actually learning autoit faster this way.

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

Thanks again smashly.. It's nice to know I'm not the only one enjoying this little script. :whistle:

This function "WM_DROPFILES_FUNC" is very nice. Where can I get more info about those dll calls?

I ought to learn about those calls too. I can be a clever coder but my knowledge in these fields is very limited; limited to what's on the Autoit Help in fact. :lmao:

Keep it coming, I'm actually learning autoit faster this way.

Your welcome, but I'm fairly clueless when it comes to dll calls and structs and such. Basic help file functions are also my limit atm.

I think the multidrop file function was originally posted by GAFrost.

On another note, since your using the MCI calls to play your audio files you may as well ad support for basic mpg and avi file playback as well. (The sound udf use mci send string to play/control your files.. Even though the mci is a bit limited and outdated method for video playback it at least offers mild support for video playback as well.

All that's needed in your script to do this is add to the file ext filter .mpg and .avi ... Whacko, your player will now play standard mpg and avi movies as well. ;)

Cheers

Edit: also you can play CD Audio (*.cda files straight from CD) using MCI (as well as other devices).

For more info/string commands on MCI (Media Control Interface) have a look at http://msdn2.microsoft.com/en-us/library/ms712587.aspx

As another side note, AVI's with VBR/ABR mp3's will play at faster speeds with no sound.. AVI's with cbr mp3's seem to play fine (xvid vid with cbr mp3 audio works great for me)

Edited by smashly
Link to comment
Share on other sites

On another note, since your using the MCI calls to play your audio files you may as well ad support for basic mpg and avi file playback as well. (The sound udf use mci send string to play/control your files..

For more info/string commands on MCI (Media Control Interface) have a look at http://msdn2.microsoft.com/en-us/library/ms712587.aspx

As another side note, AVI's with VBR/ABR mp3's will play at faster speeds with no sound.. AVI's with cbr mp3's seem to play fine (xvid vid with cbr mp3 audio works great for me)

Thanks for the tip. I'll try to add support to whatever file windows multimedia can play.

Yay!, next update is going to be a fairly big one.

I'm nearly finished with the script but right now I'm busy with Photoshop. I didn't expect it could be this fun. :whistle:

Edited by ronriel

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

Well since playing a bit more with MCI , I've worked out that you can play Xvid Avi with ABR/VBR mp3 audio using Direct show audio decoder.. this means just about any avi can be played in sync at correct speed with mci. Damn sweet it is.

Basically I've got your player playing just about any avi I have.. (All my dl'd tv episodes of Family Guy, All my own encodes from DVD of Futurama, My early days of encoding VCD's even play as well, My dl'd episodes of Stargate Atlantis. just about every avi and mpg I try works in your player now ;)

Now it's onto Xvid/AC3 encodes.. can't see any reason it won't work as well.

I'm still not able to get vob files to play using mci , but a bit more research will hopefully see it work.

Also worked out to use the MCI to adjust volume output, not using the wave adjust. So the volume being adjusted in the player doesn't affect the Wave volume control in widows sound mixer. (This includes playing wav files)

So now I have your player playing cda, wav, mp3, mid, wav, avi, mpg very close to smooth as poo :whistle:

Awsome ..

Almost tempted to make a player of my own since playing with yours has taught me some new tricks to multi media playback in AutoIt.

Thank you

Cheers N Good luck.

Edit:Got WMA audio working in your player as well.. hmmm is there not a format it won't play (providing you have the installed codecs/filters on your pc.. :lmao:

Edit: Hell I've even got your player playing h.264/AAC video using mci wich renders with Direct Show.. buwahahaha

Edited by smashly
Link to comment
Share on other sites

Well since playing a bit more with MCI , I've worked out that you can play Xvid Avi with ABR/VBR mp3 audio using Direct show audio decoder.. this means just about any avi can be played in sync at correct speed with mci. Damn sweet it is.

Basically I've got your player playing just about any avi I have.. (All my dl'd tv episodes of Family Guy, All my own encodes from DVD of Futurama, My early days of encoding VCD's even play as well, My dl'd episodes of Stargate Atlantis. just about every avi and mpg I try works in your player now ;)

Now it's onto Xvid/AC3 encodes.. can't see any reason it won't work as well.

I'm still not able to get vob files to play using mci , but a bit more research will hopefully see it work.

Also worked out to use the MCI to adjust volume output, not using the wave adjust. So the volume being adjusted in the player doesn't affect the Wave volume control in widows sound mixer. (This includes playing wav files)

So now I have your player playing cda, wav, mp3, mid, wav, avi, mpg very close to smooth as poo :whistle:

Awsome ..

Almost tempted to make a player of my own since playing with yours has taught me some new tricks to multi media playback in AutoIt.

Thank you

Cheers N Good luck.

Edit:Got WMA audio working in your player as well.. hmmm is there not a format it won't play (providing you have the installed codecs/filters on your pc.. :lmao:

Thanks for testing. I think that with mci you can play just any format that windows supports. Unfortunately, I don't have that many sample files. I have only tried .wmv and .asf. and it works fine. I'm now trying to create a window in place of the default display window so that it will be skinned as well.

Thank you for all the help smashly.

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

Nice. Wow! My first script was an MsgBox :lmao:

;) Thanks! Maybe I should change the title as this is really not my fist script but rather my first contribution (or 1st posted script?).

My first script was that "hello world" MsgBox 2 months ago.

I can still remember my excitement when i first saw it work. :whistle:

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

I really like this, it is small and easy to use. Just add the realtime volume change and it will be much better.

For those wondering about what MCI is capable of, here is a link I used when creating the _Sound UDFs http://msdn2.microsoft.com/en-us/library/ms704979.aspx

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

I really like this, it is small and easy to use. Just add the realtime volume change and it will be much better.

For those wondering about what MCI is capable of, here is a link I used when creating the _Sound UDFs http://msdn2.microsoft.com/en-us/library/ms704979.aspx

Thank you RazerM. A lot of addition is in the works right now.

Just one question: How do you create a window such that it will replace the default display window created during the "open" operation in video playback?

Thank you for the _Sound UDFs. :whistle:

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

First of all, I don't recommend you use the Sound UDFs for opening videos, I would consider it bad coding practice (my opinion), rather, you should have a look at the Sound.au3 include file and learn from them, then maybe create new UDFs.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

First of all, I don't recommend you use the Sound UDFs for opening videos, I would consider it bad coding practice (my opinion), rather, you should have a look at the Sound.au3 include file and learn from them, then maybe create new UDFs.

Errrm, I am not using _Sound UDF to open videos and I never said so. And it's not in my initial plan to add video playback functionality to this player because it's not designed for it. However, If I can get video playback to use a window that i created then maybe i will add support for it. Anyway thank you for the tip. :whistle:

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

Btw, when you search for a name, like "Paul" and you have two pauls, it will skip both names, and goto the song beneath :S

Yes, the search function is poor specially if you load lots of songs, say a thousand :whistle:

I'm making a new way wherein when you search for a song, say "paul", it will display a new separate window displaying all song titles containing "paul". Then you choose which "paul" you want.

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

I'll give a nice example of video playback in a little while.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Here it is:

#include <GUIConstants.au3>

$hVideo = GUICreate("Test Video Player :: RazerM", 340, 280)
$hPlay = GUICtrlCreateButton("Play", 10, 255, 60, 20)
$hPause = GUICtrlCreateButton("Pause", 75, 255, 60, 20)
$hLoad = GUICtrlCreateButton("Load", 140, 255, 60, 20)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            mciSendString("close Test_Video") ;free device memory
            Exit
        Case $hPlay
            mciSendString("set Test_Video time format milliseconds")
            If mciSendString("status Test_Video position") = mciSendString("status Test_Video length") Then mciSendString("seek Test_Video to 0")
            mciSendString("play Test_Video")
        Case $hPause
            mciSendString("pause Test_Video")
        Case $hLoad
            $sFile = FileOpenDialog("Open", @DesktopDir, "All Files (*.*)", 1)
            mciSendString("close Test_Video") ;free device memory
            If Not @error Then
                mciSendString("open " & FileGetShortName($sFile) & " alias Test_Video")
                mciSendString("window Test_Video handle " & Number($hVideo)) ;assign video to our GUI
                mciSendString("put Test_Video destination at 10 10 320 240") ;set top left width height
            EndIf
    EndSwitch
WEnd

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
Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

RazerM, This is cool! :whistle:

Thanks you for this. This exactly what i want. Why don't you make a UDF with something like this. It might be useful for someone. It is for me. :lmao:

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Link to comment
Share on other sites

I'm not sure video playback would be used by enough people to be worth it.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
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...