E1M1 Posted November 29, 2010 Share Posted November 29, 2010 I wrote this tool because I had 1400 mp3s in my music directory, and I wanted to remove some music I dont like anymore (I've put everything I downloaded into 1 dir). This thing here isn't best media player, but it has delete button which doesn't only remove file from playlist, but it also removes file from disk. The idea of delete button is that deleted sound wont be in your playlists you create in the future. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Sound.au3> #include <Array.au3> Dim $aList = "EMPTY", $sDir, $iLen, $iSound, $aSound, $iCurrent, $iTimer #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Crap filter", 573, 60, 226, 235) $Play = GUICtrlCreateButton("Play", 8, 32, 75, 25, BitOR($BS_ICON, $WS_GROUP)) $Stop = GUICtrlCreateButton("Stop", 96, 32, 75, 25, $WS_GROUP) $Previous = GUICtrlCreateButton("Previous", 184, 32, 75, 25, $WS_GROUP) $Next = GUICtrlCreateButton("Next", 272, 32, 75, 25, $WS_GROUP) $Delete = GUICtrlCreateButton("Delete", 360, 32, 75, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Directory", 16, 8, 46, 17) $Input1 = GUICtrlCreateInput("", 72, 5, 273, 21) $Browse = GUICtrlCreateButton("Browse", 360, 0, 75, 25, $WS_GROUP) $Label2 = GUICtrlCreateLabel("Filter", 448, 8, 26, 17) $Input2 = GUICtrlCreateInput("*.mp3", 488, 5, 81, 21) $Copy = GUICtrlCreateButton("Copy path to clipboard", 448, 32, 123, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Play If $aList = "EMPTY" Then $sDir = FileSelectFolder("Find directory contains playable files", @ScriptDir) GUICtrlSetData($Input1, $sDir) EndIf $aList = "" $iCurrent = -1 _MakeList(GUICtrlRead($Input1)) $iSound = 1 $iTimer = TimerInit() $iLen = TimerInit() + 1 AdlibRegister("_Play", 50) Case $Stop AdlibUnRegister("_Play") $iSound = 1 If IsArray($aSound) Then _SoundStop($aSound) _SoundClose($aSound) EndIf Case $Previous If $iSound > 1 Then $iSound -= 1 Else $iSound = $aList[0] EndIf Case $Next If $iSound < $aList[0] Then $iSound += 1 Else $iSound = 1 EndIf Case $Delete If IsArray($aSound) Then _SoundStop($aSound) _SoundClose($aSound) EndIf FileRecycle($sDir & "\" & $aList[$iSound]) $iSound += 1 Case $Browse $sDir = FileSelectFolder("Find directory contains playable files", @ScriptDir) GUICtrlSetData($Input1, $sDir) Case $Copy ClipPut($sDir & "\" & $aList[$iSound]) EndSwitch WEnd Func _MakeList($sPath) $aList = _FileListToArray($sPath, GUICtrlRead($Input2), 1) EndFunc ;==>_MakeList Func _Play() If TimerDiff($iTimer) > $iLen Then $iSound +=1 ConsoleWrite("Next"&@CRLF) EndIf If $iCurrent <> $iSound Then If IsArray($aSound) Then _SoundStop($aSound) _SoundClose($aSound) EndIf $aSound = _SoundOpen($sDir & "\" & $aList[$iSound]) ConsoleWrite("Playing: "& $sDir & "\" & $aList[$iSound]&@CRLF) WinSetTitle($Form1,"",$sDir & "\" & $aList[$iSound]) $iCurrent = $iSound $iLen = _SoundLength($aSound, 2) ConsoleWrite("Len: "& $iLen &@CRLF) $iTimer = TimerInit() _SoundPlay($aSound) EndIf EndFunc ;==>_Play edited 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