LIMITER Posted December 31, 2007 Posted December 31, 2007 Hy all ! How can i play the file which is selected in the listview ??? - Thanks a lot !! Here is the code :expandcollapse popup#include <GUIConstants.au3> #include <Sound.au3> #Include <GuiListView.au3> InetGet("http://img177.imageshack.us/img177/4310/lmplogomx0.jpg",@TempDir & "\lmplogo.jpg", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478222_stop.bmp",@TempDir & "\stopb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478172_pause.bmp",@TempDir & "\pauseb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478210_play.bmp",@TempDir & "\playb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478238_resume.bmp",@TempDir & "\resumeb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend GUICreate("L|M|TER Media Player - ©2008 L|M|TER",650, 160) GUISetState() GUICtrlCreatePic(@TempDir & "\lmplogo.jpg", 29.5, 5, 391, 63) GUICtrlCreateLabel("Select a file to play :",5,80) $hWnd = WinGetHandle("L|M|TER Media Player - ©2008 L|M|TER") $input = GUICtrlCreateInput("",5,100,250) $browse = GUICtrlCreateButton(" Browse ... ",265,98) $play = GUICtrlCreateButton("",5,125,30,30,$BS_BITMAP) $stop = GUICtrlCreateButton("",42,125,30,30,$BS_BITMAP) $pause = GUICtrlCreateButton("",80,125,33,30,$BS_BITMAP) $resume = GUICtrlCreateButton("",121,125,33,30,$BS_BITMAP) $about = GUICtrlCreateButton(" About LMP ",160,125) $add = GUICtrlCreateButton("Add ",417,30) $rem = GUICtrlCreateButton("Rem",417,55) $pplay = GUICtrlCreateButton("Play ", 417,80) $status = GUICtrlCreateLabel("Status : FILE NOT OPENED", 300,135) $playlist = _GUICtrlListView_Create($hWnd,"LMP Playlist",450,5,195) GUICtrlSetImage($play,@TempDir & "\playb.bmp") GUICtrlSetImage($pause,@TempDir & "\pauseb.bmp") GUICtrlSetImage($stop,@TempDir & "\stopb.bmp") GUICtrlSetImage($resume,@TempDir & "\resumeb.bmp") TrayTip("L|M|TER MEDIA PLAYER", "File not opened ...", 2, 1) $sound = _SoundOpen("") Func browse() $file = FileOpenDialog("Select a file to play ...", @HomeDrive,"Music Files (*.mp3;*.wav)") If @error = 1 Then MsgBox(32,"L|M|TER Media Player","Please select a file !") GUICtrlSetData($input,$file) $sound = _SoundOpen($file) GUICtrlSetData($status,"Status : STOPPED ...") TrayTip("L|M|TER MEDIA PLAYER", "Stopped ...", 2, 1) EndFunc Func play() _SoundPlay($sound) GUICtrlSetData($status,"Status : PLAYING ...") TrayTip("L|M|TER MEDIA PLAYER", "Playing ...", 2, 1) EndFunc Func stop() _SoundStop($sound) GUICtrlSetData($status,"Status : STOPPED ...") TrayTip("L|M|TER MEDIA PLAYER", "Stopped ...", 2, 1) EndFunc Func pause() _SoundPause($sound) GUICtrlSetData($status,"Status : PAUSED ...") TrayTip("L|M|TER MEDIA PLAYER", "Paused ...", 2, 1) EndFunc Func resume() _SoundResume($sound) GUICtrlSetData($status,"Status : PLAYING ...") TrayTip("L|M|TER MEDIA PLAYER", "Playing ...", 2, 1) EndFunc Func about() MsgBox(32,"About", "L|M|TER MEDIA PLAYER" & @CR & "v. 1.0.2" & @CR & "Copyright ©2008 L|M|TER") EndFunc Func add() $song = FileOpenDialog("Add a file to playlist", @HomeDrive,"Music Files (*.mp3;*.wav)") _GUICtrlListView_AddItem($playlist,$song) EndFunc Func rem() _GUICtrlListView_DeleteItemsSelected($playlist) EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop _SoundClose($sound) Case $msg = $browse Call("browse") Case $msg = $play Call("play") Case $msg = $stop Call("stop") Case $msg = $pause Call("pause") Case $msg = $resume Call("resume") Case $msg = $about Call("about") Case $msg = $add Call("add") Case $msg = $rem Call("rem") EndSelect Wend
i542 Posted December 31, 2007 Posted December 31, 2007 Get selected file from ListView and then play it. I can do signature me.
James Posted December 31, 2007 Posted December 31, 2007 Isn't this the second topic you just made? Why not do a topic with all of your questions in? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 Get selected file from ListView and then play it.what's the code to get the selected item ??
James Posted December 31, 2007 Posted December 31, 2007 Heard of the helpfile? Look in it for _GuiCtrlList_ and look through the functions. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 (edited) Heard of the helpfile? Look in it for _GuiCtrlList_ and look through the functions.THX for the post - because i can't find that functionOh ! and one thing ... my control isn't a LIST BOX is a LIST VIEW !! P.S - i searched the helpfile before but didn't find the function , so excuse me Edited December 31, 2007 by LIMITER
i542 Posted December 31, 2007 Posted December 31, 2007 what's the code to get the selected item ??GuiCtrlRead($control)Heard of the helpfile? Look in it for _GuiCtrlList_ and look through the functions.Arg...get your own...this one is mine I can do signature me.
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 GuiCtrlRead($control)Arg...get your own...this one is mineIt doesn't work either way !
James Posted December 31, 2007 Posted December 31, 2007 Let's see what you have tried.q Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 Let's see what you have tried.qi'm now trying to create a listview using GUICtrlCreateListView not _GUICtrlListView_create how i created it beforei will notice you if it works or not .
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 i'm now trying to create a listview using GUICtrlCreateListView not _GUICtrlListView_create how i created it before i will notice you if it works or not . I used the guictrlread function but that is not returning the text of the item , it returns only the ID .What function should i use to be able to play the item in the listview ? expandcollapse popup#include <GUIConstants.au3> #include <Sound.au3> #Include <GuiListView.au3> InetGet("http://img177.imageshack.us/img177/4310/lmplogomx0.jpg",@TempDir & "\lmplogo.jpg", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478222_stop.bmp",@TempDir & "\stopb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478172_pause.bmp",@TempDir & "\pauseb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478210_play.bmp",@TempDir & "\playb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend InetGet("http://www.imagehosting.com/out.php/i1478238_resume.bmp",@TempDir & "\resumeb.bmp", 1, 1) While @InetGetActive TrayTip("Welcome " & @UserName & " !","Please wait while LMP is loading ...", 1, 1) Sleep(1500) Wend GUICreate("L|M|TER Media Player - ©2008 L|M|TER",650, 160) GUISetState() GUICtrlCreatePic(@TempDir & "\lmplogo.jpg", 29.5, 5, 391, 63) GUICtrlCreateLabel("Select a file to play :",5,80) $hWnd = WinGetHandle("L|M|TER Media Player - ©2008 L|M|TER") $input = GUICtrlCreateInput("",5,100,250) $browse = GUICtrlCreateButton(" Browse ... ",265,98) $play = GUICtrlCreateButton("",5,125,30,30,$BS_BITMAP) $stop = GUICtrlCreateButton("",42,125,30,30,$BS_BITMAP) $pause = GUICtrlCreateButton("",80,125,33,30,$BS_BITMAP) $resume = GUICtrlCreateButton("",121,125,33,30,$BS_BITMAP) $about = GUICtrlCreateButton(" About LMP ",160,125) $add = GUICtrlCreateButton("Add ",417,30) $rem = GUICtrlCreateButton("Rem",417,55) $pplay = GUICtrlCreateButton("Play ", 417,80) $status = GUICtrlCreateLabel("Status : FILE NOT OPENED", 300,135) $playlist = GUICtrlCreateListView("LMP Playlist",450,5,195,150) GUICtrlSetImage($play,@TempDir & "\playb.bmp") GUICtrlSetImage($pause,@TempDir & "\pauseb.bmp") GUICtrlSetImage($stop,@TempDir & "\stopb.bmp") GUICtrlSetImage($resume,@TempDir & "\resumeb.bmp") TrayTip("L|M|TER MEDIA PLAYER", "File not opened ...", 2, 1) $sound = _SoundOpen("") Func browse() $file = FileOpenDialog("Select a file to play ...", @HomeDrive,"Music Files (*.mp3;*.wav)") If @error = 1 Then MsgBox(32,"L|M|TER Media Player","Please select a file !") GUICtrlSetData($input,$file) $sound = _SoundOpen($file) GUICtrlSetData($status,"Status : STOPPED ...") TrayTip("L|M|TER MEDIA PLAYER", "Stopped ...", 2, 1) EndFunc Func play() _SoundPlay($sound) If _SoundPlay = "" Then MsgBox(32,"L|M|TER MEDIA PLAYER","Please select a file to play.") GUICtrlSetData($status,"Status : PLAYING ...") TrayTip("L|M|TER MEDIA PLAYER", "Playing ...", 2, 1) EndFunc Func stop() _SoundStop($sound) GUICtrlSetData($status,"Status : STOPPED ...") TrayTip("L|M|TER MEDIA PLAYER", "Stopped ...", 2, 1) EndFunc Func pause() _SoundPause($sound) GUICtrlSetData($status,"Status : PAUSED ...") TrayTip("L|M|TER MEDIA PLAYER", "Paused ...", 2, 1) EndFunc Func resume() _SoundResume($sound) GUICtrlSetData($status,"Status : PLAYING ...") TrayTip("L|M|TER MEDIA PLAYER", "Playing ...", 2, 1) EndFunc Func about() MsgBox(32,"About", "L|M|TER MEDIA PLAYER" & @CR & "v. 1.0.2" & @CR & "Copyright ©2008 L|M|TER") EndFunc Func add() $song = FileOpenDialog("Add a file to playlist", @HomeDrive,"Music Files (*.mp3;*.wav)") GUICtrlCreateListViewItem($song,$playlist) EndFunc Func rem() $selected = GuiCtrlRead($playlist) GUICtrlDelete($selected) EndFunc Func pplay() $selected = GuiCtrlRead($playlist) MsgBox(32,"",$selected) EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop _SoundClose($sound) Case $msg = $browse Call("browse") Case $msg = $play Call("play") Case $msg = $stop Call("stop") Case $msg = $pause Call("pause") Case $msg = $resume Call("resume") Case $msg = $about Call("about") Case $msg = $add Call("add") Case $msg = $rem Call("rem") Case $msg = $pplay Call("pplay") EndSelect Wend
James Posted December 31, 2007 Posted December 31, 2007 _SoundPlay() Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 _SoundPlay()i found the function that get's the text from the item but it has a trailing "|" it look like this $something = GuiCtrlRead(the id of the selected item) msgbox(32,"",$something)and in the msgbox is the text : for example "c:\music\musicfile.mp3|"how could i remove that |
Paulie Posted December 31, 2007 Posted December 31, 2007 i found the function that get's the text from the item but it has a trailing "|" it look like this $something = GuiCtrlRead(the id of the selected item) msgbox(32,"",$something) and in the msgbox is the text : for example "c:\music\musicfile.mp3|" how could i remove that |If StingInStr($something, "|") then StringTrimRight($Something,1)
Zedna Posted December 31, 2007 Posted December 31, 2007 I used the guictrlread function but that is not returning the text of the item , it returns only the ID .What function should i use to be able to play the item in the listview ?_GUICtrlListView_GetNextItem() and then _GUICtrlListView_GetItemText() You must use latest AutoIt 3.2.10 Look into Helpfile for details/examples. Resources UDF ResourcesEx UDF AutoIt Forum Search
LIMITER Posted December 31, 2007 Author Posted December 31, 2007 Thx all for help ... i managed to make it play the list item
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