#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Bureau\Image\MUBY.ico #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #Include #include #include #include #include #Include #include #include #include #Include #include #Include #Include Global $MyIni = @ScriptDir & "\Listmusique.ini" If Not FileExists($MyIni) Then IniWrite ($MyIni, "musiques", "musique1", "") EndIf #Region ## Form= Global $Form1 = GUICreate("Lecteur MUBY", 516, 183, 192, 124) Global $Button1 = GUICtrlCreateButton("PLAY", 344, 120, 163, 49) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Button2 = GUICtrlCreateButton("PAUSE", 176, 120, 161, 49) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Slider1 = GUICtrlCreateSlider(8, 80, 358, 37) Global $Label1 = GUICtrlCreateLabel("VOLUME", 152, 64, 79, 17) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Button5 = GUICtrlCreateButton("AJOUTER MUSIQUE", 376, 8, 129, 49) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Progress1 = GUICtrlCreateProgress(8, 32, 358, 25, $PBS_SMOOTH) GUICtrlSetColor(-1, 0x00FF00) Global $Button4 = GUICtrlCreateButton("STOP", 8, 120, 161, 49) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $combobox = GUICtrlCreateCombo("Musique", 8, 8, 361, 25) GUICtrlSetData(-1, "") Global $Button3 = GUICtrlCreateButton("DELETE", 376, 64, 129, 49) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $var = IniReadSection($MyIni, "musiques") $nbitems = $var[0][0] For $i = $nbitems To 1 step -1 If FileExists ($var[$i][1]) Then GUICtrlSetData($combobox, $var[$i][1] & "|", $var[$nbitems][1]) Next _savelist() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $souce = "" $sound = 0 $vol = 100 $volume = "" $zic = GUICtrlRead($combobox) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Slider1 SoundSetWaveVolume(GUICtrlRead($slider1)) Case $Button5 $source = FileOpenDialog("Ouvrir:",@DesktopDir&'\',"mp3 (*.mp3)|wav (*.wav)|wma (*.wma)|a52 (*.a52)|acc (*.acc)|ac3 (*.ac3)|ogg (*.ogg)|flac (*.flac)|mp1 (*.mp1)|mp2 (*.mp2)|mp4 (*.mp4)|oga (*.oga)",9) If $source = "" Then MsgBox(16,"titre","Erreur, aucune musique n'a été choisis !") If $source <> "" Then GUICtrlSetData($combobox, $source) _savelist() EndIf Case $Button1 Local $Selected = GUICtrlRead($combobox) If $sound = 0 Then $sound = _SoundOpen($Selected) If _SoundPlay($sound) <> 0 Then $current_length = _SoundLength($sound, 2) AdlibRegister("Update_Progress1", 1000) EndIf Else If _SoundStatus($sound) = "paused" Then _SoundResume($sound) Else _SoundClose($sound) $sound = _SoundOpen($Selected) If _SoundPlay($sound) <> 0 Then $current_length = _SoundLength($sound, 2) AdlibRegister("Update_Progress1", 1000) EndIf EndIf EndIf If $Selected == 0 Then ContinueLoop Case $Button2 If $sound <> 0 Then _SoundPause($sound) Endif Case $Button4 stop_chanson() Case $Button3 _delitem() EndSwitch WEnd Func _savelist() IniDelete ($MyIni, "images") $combolist = _GUICtrlComboBox_GetListArray ( $combobox) For $i = ($combolist[0]) to 1 step -1 IniWrite ($MyIni, "musiques", "musique" & ($combolist[0]-$i+1), $combolist[$i] ) Next EndFunc Func Update_Progress1() local $staus,$position If IsArray($sound) Then $position=_SoundPos($sound, 2) If $position>=$current_length Then stop_chanson() Return EndIf $status=_SoundStatus ( $sound ) Select Case $status="playing" $percent = Round(($position/$current_length)*100) GuiCtrlSetData($Progress1, $percent) Case $status="stoped" stop_chanson() Return Case Else Return EndSelect EndIf EndFunc Func stop_chanson() AdlibUnRegister("Update_Progress1") _SoundStop($sound) _SoundClose($sound) GuiCtrlSetData($Progress1, 0) $sound=0 $source="" EndFunc Func _delitem() ; supprime item et réactualise la combo et la gui $item = GuiCtrlRead($combobox) ShellExecute($MyIni) $index = _GUICtrlComboBox_FindString($combobox, $item) _GUICtrlComboBox_DeleteString($combobox, $index) Sleep(250) MsgBox(0, "Supprimer", "Supprimer la ligne complète où il y a: "&$item, 0, 0) EndFunc ;===>_delitem()