Sithe Posted December 21, 2007 Share Posted December 21, 2007 (edited) 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 December 21, 2007 by Sithe Link to comment Share on other sites More sharing options...
monoceres Posted December 21, 2007 Share Posted December 21, 2007 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") EndselectUntil $msg = $GUI_EVENT_CLOSEYou 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.au3Good LuckGood Luck! Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now