Jump to content

Need help with a Media Player


Sithe
 Share

Recommended Posts

This is a media player I am making just to practice Auto It, I started today.

I still don't understand the whole GUIGetMsg, GUICtrlRead, and CUICtrlSetData functions, so if someone could explain them that would be great.

Anyways, on to the program.

My problem is that when it outputs what I have selected it adds a "|" to the end of it.

That is a problem because have the output saved to the $song variable, and I use the song variable in SoundPlay.

It just so happens you can't name a file with a "|" in it. So the songs wont play when I select them.

Thanks for all your help in advance!

CODE
;Media Player;

#include <GUIConstants.au3>

$gui=GUICreate("Background", 300, 200)

GUISetState(@SW_SHOW)

GuiCtrlCreateLabel("Song List",0,0)

$songlist = GUICtrlCreateListView ("Song ",0,20,200,150)

$item1 = GUICtrlCreateListViewItem("Black Star",$songlist)

$item2 = GUICtrlCreateListViewItem("Child's Play",$songlist)

$button = GUICtrlCreateButton ("Select",75,170,70,20)

GUICtrlSetData($item1,"Black")

GUICtrlSetData($item2,"Child")

Do

$msg = GUIGetMsg ()

Select

Case $msg = $button

$song = MsgBox(0,"Song",GUICtrlRead(GUICtrlRead($songlist)))

SoundPlay($song".mp3")

Endselect

Until $msg = $GUI_EVENT_CLOSE

Edited by Sithe
Link to comment
Share on other sites

CODE
;Media Player;

#include <GUIConstants.au3>

$gui=GUICreate("Background", 300, 200)

GUISetState(@SW_SHOW)

GuiCtrlCreateLabel("Song List",0,0)

$songlist = GUICtrlCreateListView ("Song ",0,20,200,150)

$item1 = GUICtrlCreateListViewItem("Black Star",$songlist)

$item2 = GUICtrlCreateListViewItem("Child's Play",$songlist)

$button = GUICtrlCreateButton ("Select",75,170,70,20)

GUICtrlSetData($item1,"Black")

GUICtrlSetData($item2,"Child")

Do

$msg = GUIGetMsg ()

Select

Case $msg = $button

$song = MsgBox(0,"Song",GUICtrlRead(GUICtrlRead($songlist)))

SoundPlay($song".mp3")

Endselect

Until $msg = $GUI_EVENT_CLOSE

You code need some cleaning up, first you are using the GUICtrlRead wrong, just let $song = GUICtrlRead($songlist) and also when you join strings you have to join them with an &, so SoundPlay($song".mp3")

should be SoundPlay($song&".mp3")

If you want to make a audioplayer wich has a bit more futueres look into the UDF sound.au3

Good Luck

Good Luck!

Broken link? PM me and I'll send you the file!

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