Jump to content

My 1st Autoit Script - A Media Player


ronriel
 Share

Recommended Posts

After long days of reading the Autoit Help and experimenting with the scripts this is what I've got. :mad:

And hey, this forum is great! Very helpful.

Features:

1. Play/pause, stop, skip tracks.

2. Random play, Loop track.

3. Volume control

4. Seek function.

5. Import PLS and M3U playlists.

6. Load single/multiple audio files by folder/subfolder.

7. Playlist search functionality (to be improved).

Updated: Added lyric search feature :) - 07012007

The player will automatically search for the lyrics of the songs you play if the Lyric window is open.

Just push the button beside the scrolling label to toggle showing/hiding of the lyric window.

You will have two options, either search on absolutelyrics.com or azlyrics.com. (more soon)

Lyrics found are automatically stored in a folder at @scriptdir so it don't have to search again for lyrics already found.

Note:

If you have very slow internet connection that you cannot load a web page under 15 seconds you will have to adjust this:

If $var3 = 15 Then

or you will always get a "no lyrics found". I turned off IELoadwait so that it will not freeze the GUI while waiting for the page to finish loading.

After 15 sec. (assuming that page load is complete) the script will return to the page to retrieve the lyrics if found.

Enjoy!

Finally, Update! :) 07252007

- Skins! You can change skins through the context menu.

- Some context menu.

- Realtime volume tooltip. (thank you smashly)

- Realtime song position tooltip.

- Double-click-on-list to play function.

- Drag & drop single/multiple files/folders including playlists.

- Toggle always-on-top attribute.

- Greatly improved search function.

- Now remembers previously played songs so the "previous" button now functions correctly.

- remembers settings. (more to come)

- Some window animations.

- Fixed issue with playlist import causing duplication of songs on the list.

- Can now import multiple playlist at once.

- Can now play Videos. (thank you RazerM) Only *.asf and *.wmv have been tested however :x.

Play at 1x or 2x display size or at fullscreen. Press Alt+F to toggle fullscreen playback.

- The following filetypes can now be loaded:

*.cda; *.mp3; *.wav; *.wma;*.asf; *.mpg; *.wmv; *.avi

(more will be added or removed.)

- Now uses much less RAM

- Removed many unneccessary lines of code from the first version. (maybe more are added instead :rolleyes: )

- Some minor optimizations.

The skin is quite unfinished but I am running out of freetime, so here it is for purpose of demonstration.

More skins to come when I come back. :rambo:

Zip contains the skin, the source code and the compiled script.

I have so much fun making this. I hope you enjoy this too.

Version1 - 06292007:

r4r.au3

Version2 - 07012007:

r4r.au3

Version3 - 07252007: +44 d

r4r_v3.zip

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

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Very nice! I found one problem if ya search or try to open another song in the playlist it will not change the song. Everything else is pretty smooth...

Thank you gesller. Maybe you're pressing the Play/Pause button. I made it to toggle play and pause. if you want to change songs then you will have to press stop button first, select a song from the list then press Play. You can also double click the song on the list or select a song then press enter.

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

Link to comment
Share on other sites

Update:

There's one thing i forgot: when you load files by directories, it will only add .mp3's. This is now fixed. But until i know what specific file types _Soundplay supports, this will only load *.wav and *.mp3...

But that's easy, just add a filter here == _SubDirFileListToArray("*.wav;*.mp3","Add Folder(s)")== with ";" as delimiter.

I don't know if some UDF with this function have been made before, but this one is by me. I used MScreator's "_DirListToArray" to list the sub folders.

Enjoy! :rolleyes:

Source:

Edited: See 1st post.

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

xxx\temp_344fv.au3(403,26) : ERROR: syntax error
    GUICtrlSetData ($L3, &
~~~~~~~~~~~~~~~~~~~~~~~~~^
xxx\temp_344fv.au3 - 1 error(s), 0 warning(s)

I get this error in both versions. Remove the & behind the comma. It's useless. Cand copy it behind the ">" -> GUICtrlSetData ($L3,"> " & $hour&$min&":"&$sec)

If this is your first script, it's really awsome!

Edited by Sn0opy
Link to comment
Share on other sites

Nice script! I know my first script was much worse. :rolleyes: But I found something annoying for me, the thing is, I'm using a theme on my XP (if anyone's interested, it's Crystal Clear from Bricopacks). Both of your script sliders are quite tiny, so it's hard to see how far song is or set volume for me. Here's a picture:

Posted Image

Hope you can fix this!

Edited by poisonkiller
Link to comment
Share on other sites

xxx\temp_344fv.au3(403,26) : ERROR: syntax error
    GUICtrlSetData ($L3, &
~~~~~~~~~~~~~~~~~~~~~~~~~^
xxx\temp_344fv.au3 - 1 error(s), 0 warning(s)

I get this error in both versions. Remove the & behind the comma. It's useless. Cand copy it behind the ">" -> GUICtrlSetData ($L3,"> " & $hour&$min&":"&$sec)

If this is your first script, it's really awsome!

Yes, you're right! It's supposed to give an error. I wonder why it never gave me error. :rolleyes:

Thanks snoopy, i did not notice it until now.

Yes, this my first "official" script. But of course this could not be my very first because I make little scripts following the examples on the Autoit Help. I made this to see how much I've learned from the many days of reading and reading the help file. :rambo:

[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 script! I know my first script was much worse. :rolleyes: But I found something annoying for me, the thing is, I'm using a theme on my XP (if anyone's interested, it's Crystal Clear from Bricopacks). Both of your script sliders are quite tiny, so it's hard to see how far song is or set volume for me. Here's a picture:

Posted Image

Hope you can fix this!

Yes they are tiny. I also use a theme for my XP which makes them so tiny. But because i assume that most users will be using the default windows theme so i designed the GUI under the default Luna Theme.

Anyway, its easy to make them bigger. Just edit this:

$Spos = GUICtrlCreateSlider(188, 183, 135, 20,0x0010)
$vs = GUICtrlCreateSlider (255, 161, 100, 20,0x0010)

Just edit the height of the control. I think 20 should be fine for you. Just experiment and see what's best for you.

Enjoy!

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

Link to comment
Share on other sites

hi

nice work

but for me its missing

#include <GUIConstants.au3>

Thank you for the compliment.

...the GuiConstants, well, i forgot. :rolleyes: . But nothing to worry about since it is already included in the other "includes".

For instance, Array.au3 already have "#include <GuiConstants.au3>" so it's already there. :rambo:

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

Link to comment
Share on other sites

this is cool, may I borrow your source and build on it?

Sure you may... The reason I posted it here is to share it to everybody. I guess that's what this forum is for.

Well, just give me due credit for the code. :whistle:

Enjoy!

[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 job ronriel, Thank you for sharing :whistle:

Minor error

C:\#AutoIt Projects Misc\r4rorig.au3(383,26) : ERROR: syntax error
    GUICtrlSetData($Lwin,"",)
    ~~~~~~~~~~~~~~~~~~~~~~~~^

Suggestion:

It would be possible to make the Volume go up and down while sliding the slider in real time while displaying a Tooltip with current volume by changing the volume function to:

Func Volume()
    GUICtrlSetTip ($vs, "Volume = "&GuiCtrlRead ($vs))
    ToolTip('')
EndFuncoÝ÷ Ø]ýÈZ¿×[+y©Ý|¨ºµ¡Wµ)z®¶­sbb33cµföÄöÆBÒwV7G&Å&VBb33c·g2 ¥vÆR 6ÆVW²fÇC²Ò6WBFò6ÖÆÆW"6ÆVW6òFRföÇVÖRÆWfVÂ6ævW2Ö÷&R67W&FVÇvÆR&Vær6ÆBà bwV7G&Å&VBb33c·g2fÇC²fwC²b33cµföÄöÆBFVà 6÷VæE6WEvfUföÇVÖRwV7G&Å&VBb33c·g2 FööÅFgV÷CµföÇVÖRÒgV÷C²fײwV7G&Å&VBb33c·g2 b33cµföÄöÆBÒwV7G&Å&VBb33c·g2 VæD

The trade off of this is it effects the speed of your scrolling msg text, surely there's a better way to adjust the scroll speed of your text then using a large sleep in the main while 1 loop, maybe put your scrolling text into a function with a sleep, then use AdlibEnable to control the scrolling message function, this way your main loop stays free of long sleeps.

Cheers

Link to comment
Share on other sites

one question, the silence between tracks when on random play, is that programmed in the code or part of Sound.au3, and is there a way to close the gap between song end and next song start?

cheers

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

Nice job ronriel, Thank you for sharing :lmao:

Minor error

C:\#AutoIt Projects Misc\r4rorig.au3(383,26) : ERROR: syntax error
    GUICtrlSetData($Lwin,"",)
    ~~~~~~~~~~~~~~~~~~~~~~~~^
Thanks, I couldn't have noticed that soon. What utility do you use to check for syntax errors?

I wonder why those minors errors are not reported on my machine. :whistle:

Suggestion:

It would be possible to make the Volume go up and down while sliding the slider in real time while displaying a Tooltip with current volume by changing the volume function to:

Func Volume()
    GUICtrlSetTip ($vs, "Volume = "&GuiCtrlRead ($vs))
    ToolTip('')
EndFuncoÝ÷ Ø]ýÈZ¿×[+y©Ý|¨ºµ¡Wµ)z®¶­sbb33cµföÄöÆBÒwV7G&Å&VBb33c·g2 ¥vÆR 6ÆVW²fÇC²Ò6WBFò6ÖÆÆW"6ÆVW6òFRföÇVÖRÆWfVÂ6ævW2Ö÷&R67W&FVÇvÆR&Vær6ÆBà bwV7G&Å&VBb33c·g2fÇC²fwC²b33cµföÄöÆBFVà 6÷VæE6WEvfUföÇVÖRwV7G&Å&VBb33c·g2 FööÅFgV÷CµföÇVÖRÒgV÷C²fײwV7G&Å&VBb33c·g2 b33cµföÄöÆBÒwV7G&Å&VBb33c·g2 VæD

The trade off of this is it effects the speed of your scrolling msg text, surely there's a better way to adjust the scroll speed of your text then using a large sleep in the main while 1 loop, maybe put your scrolling text into a function with a sleep, then use AdlibEnable to control the scrolling message function, this way your main loop stays free of long sleeps.

Cheers

Thanks for the tip smashly. That will be useful on my other scripts.

But on this one, it will just shoot CPU usage to about 30 percent and render my scrolling text unreadable.

Anyway, i don't change my volume that often. I just leave it at 100%.

Maybe there's some other way I could integrate that on my script..

But right now i'm busy on other things.(i'm making a skinning logic for this player) ;)

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

Link to comment
Share on other sites

one question, the silence between tracks when on random play, is that programmed in the code or part of Sound.au3, and is there a way to close the gap between song end and next song start?

No, it's not programmed in the code and I think it's not part of Sound.au3.

But how long are those silences? If they're only a small fraction of a second long then it's understandable.

It's just the script doing it's job.

If you're noticing very long silences, then it's not a "silence between tracks".

It's the silence at the end or at the beginning of your audio file. I use Audacity to trim those silences off my mp3's.

cheers!

[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 I did things the other way round to get the volume to work in real time with minimal to no CPU usage while not interfering with your scrolling text.

I added my code into a function and call it by AdlibEnable. Seems to work ok.

In case you change your mind

I added this below GUISetState (@SW_SHOW, $gui1)

AdlibEnable('RealTimeVolume', 10)
$VolOld = GuiCtrlRead($vs)oÝ÷ ØÞ¦Vyܨº»èé~éܶ*'Â+ajëh×6Func Volume()
    GUICtrlSetTip ($vs, "Volume = "&GuiCtrlRead ($vs))
    ToolTip('')
EndFuncoÝ÷ ØuçZ²f¥w°~éܶ*'¶¨º¹b²Ú~éܶ*'±«­¢+ÙÕ¹I±Q¥µY½±Õµ ¤(%%Õ¥
ÑɱI ÀÌØíṲ̀±ÐìÐìÀÌØíY½±=±Q¡¸($%M½Õ¹MÑ]ÙY½±Õµ¡Õ¥
ÑɱI ÀÌØíṲ̀¤($%Q½½±Q¥À ÅÕ½ÐíY½±ÕµôÅÕ½ÐìµÀìÕ¥
ÑɱI ÀÌØíṲ̀¤($$ÀÌØíY½±=±ôÕ¥
ÑɱI ÀÌØíṲ̀(%¹%)¹Õ¹

Walla.. your script doesn't seem to be affected any and I get volume level adjusted while sliding the slider with a tooltip telling the current volume while sliding :whistle:

Cheers

Link to comment
Share on other sites

Cool. Thanks smashly. you're very helpful. :whistle:

That is definitely going with my next version.

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

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