LIMITER Posted January 17, 2008 Share Posted January 17, 2008 Hello Everyone ! How can i get the *.mp3 files from a directory and add them to a listview control ?Thx All !expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=c:\autoit\mp3.kxf $Form1_1 = GUICreate("MP3 Player Manager - © 2008 L|M|TER", 526, 317, 193, 125) $txt = GUICtrlCreateLabel("Welcome to MP3 Player Manager - © 2008 L|M|TER !", 10, 10, 306, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) $pc = GUICtrlCreateListView("Files on PC playlist", 10, 35, 250, 150) GUICtrlSendMsg(-1, 0x101E, 0, 246) $ListView1 = GUICtrlCreateListView("Files on MP3 Player", 265, 35, 250, 150) GUICtrlSendMsg(-1, 0x101E, 0, 246) $mp3dir = GUICtrlCreateButton("Select MP3 folder", 265, 190, 100, 25, 0) $pcdir = GUICtrlCreateButton("Select PC Folder", 10, 190, 95, 25, 0) $progress = GUICtrlCreateProgress(10, 240, 505, 17) $syncbtn = GUICtrlCreateButton("Sync !", 10, 280, 505, 25, 0) GUICtrlSetFont(-1, 12, 800, 0, "Digital Readout Upright") $status = GUICtrlCreateLabel("MP3 Player not connected", 360, 10, 154, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colEvents = $objWMIService.ExecNotificationQuery _ ("Select * From __InstanceOperationEvent Within 5 Where " _ & "TargetInstance isa 'Win32_LogicalDisk' and " _ & "TargetInstance.DriveType = 2" ) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit $objEvent = $colEvents.NextEvent If $objEvent.TargetInstance.DriveType = 2 Then Select Case $objEvent.Path_.Class()="__InstanceCreationEvent" ;Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & " has been added." & @CR) GUICtrlSetData($status,"MP3 Player Connected !" GUICtrlSetColor($status, 0x008000) Case $objEvent.Path_.Class()="__InstanceDeletionEvent" ;Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & " has been removed."& @CR) GUICtrlSetData($status,"MP3 Player Disconected !" GUICtrlSetColor(-1, 0xFF0000) EndSelect EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
Glyph Posted January 17, 2008 Share Posted January 17, 2008 (edited) I had a problem similiar to this here:http://www.autoitscript.com/forum/index.ph...mp;#entry447377 Edited January 17, 2008 by BackStabbed tolle indicium Link to comment Share on other sites More sharing options...
LIMITER Posted January 17, 2008 Author Share Posted January 17, 2008 I had a problem similiar to this here:http://www.autoitscript.com/forum/index.ph...mp;#entry447377i'm searching for a script that puts all the *.mp3 files in a directory selected by user into a listview control. Link to comment Share on other sites More sharing options...
Nahuel Posted January 17, 2008 Share Posted January 17, 2008 Something like this? #include <GUiConstants.au3> #include <File.au3> $Form1 = GUICreate("Form1", 322, 438, 297, 131) $MusicDir=FileSelectFolder("Please select a folder",@HomeDrive) $ListView1 = GUICtrlCreateListView("Mp3 files at " & $MusicDir, 16, 4, 289, 413) If @error Then Exit $filesArray=_FileListToArray($MusicDir,"*.mp3") For $i=1 To $filesArray[0] GUICtrlCreateListViewItem($filesArray[$i],$ListView1) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
LIMITER Posted January 17, 2008 Author Share Posted January 17, 2008 Something like this? #include <GUiConstants.au3> #include <File.au3> $Form1 = GUICreate("Form1", 322, 438, 297, 131) $MusicDir=FileSelectFolder("Please select a folder",@HomeDrive) $ListView1 = GUICtrlCreateListView("Mp3 files at " & $MusicDir, 16, 4, 289, 413) If @error Then Exit $filesArray=_FileListToArray($MusicDir,"*.mp3") For $i=1 To $filesArray[0] GUICtrlCreateListViewItem($filesArray[$i],$ListView1) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd THX A LOT Nahuel !!! 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