PHP Code:
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
#include <Array.au3>
#include <Misc.au3>
;------------------------------------------------------------
;Script begins after this text.
;Script by Kilroy. @elitepvpers.com
;Help by BladeTiger12 @elitepvpers.com
;
; AUTOIT VERSION 8.3.3.3
;------------------------------------------------------------
If _Singleton("Musicplayer", 1) = 0 Then
Exit
EndIf
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Mp3 Player", 346, 159, -1, -1)
$Button1 = GUICtrlCreateButton(".mp3", 136, 8, 59, 25)
$Button2 = GUICtrlCreateButton("Play", 8, 8, 59, 25)
$Button3 = GUICtrlCreateButton("Stop", 72, 8, 59, 25)
$Label1 = GUICtrlCreateLabel("Keine Datei ausgewählt.", 8, 56, 327, 33)
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x000000)
$Progress1 = GUICtrlCreateProgress(8, 96, 326, 9)
$Slider1 = GUICtrlCreateSlider(8, 112, 326, 29)
$Label3 = GUICtrlCreateLabel("low", 13, 139, 20, 17)
$Label4 = GUICtrlCreateLabel("middle", 152, 139, 34, 17)
$Label5 = GUICtrlCreateLabel("high", 312, 139, 24, 17)
$Button4 = GUICtrlCreateButton("Playlist", 200, 8, 59, 25)
$Button5 = GUICtrlCreateButton("Delete Playlist", 264, 8, 75, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Playlistabspielen", 16, 35, 97, 17)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
Global $hSound, $lol, $Lenght, $Pos, $Open, $Playlistplay, $PlayYet = 0, $PlayOn = 0, $Txt
Dim $ButtonSend = False
AdlibRegister("_Play", 50)
While Sleep(10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1 ;Öffnet FileDialog zum Auswählen einer einzigen Datei
_OpenMusik()
Case $Button2 ;Wandelt Play in Pause und umgekehrt Stopt und Played die Musik
_StartStop()
Case $Button3 ;Beendet die Musik ganz
_StopMusik()
Case $Button4 ;Soll FIleOpenDialog öffnen und man muss dann alle Dateien auswählen und er schreibt die dann in die Playlist.ini
_CreatePlayList()
Case $Button5 ;Löscht die Playlist.ini
_DeletPlaylist()
Case $Slider1 ;Regelt die Lautstärke
$Read = GUICtrlRead($Slider1)
SoundSetWaveVolume($Read)
EndSwitch
WEnd
Func _PlayPlaylist()
If $PlayOn <> 1 Then
$Lied = IniRead(@ScriptDir & "\Playlist.tke", $Playlistplay, "Lied" & $PlayYet, "")
If $Lied = "" Then
$PlayYet = 0
$Lied = IniRead(@ScriptDir & "\Playlist.tke", $Playlistplay, "Lied" & $PlayYet, "")
EndIf
$Open = _SoundOpen($Lied)
$hSound = _SoundPlay($Open,0)
$PlayOn = 1
GUiCtrlSetData($Label1, $Lied)
Else
$Aktuelle_Position = _SoundPos($Open, 2)
$Maximale_Laenge = _SoundLength($Open, 2)
If $Aktuelle_Position >= $Maximale_Laenge Then
$PlayYet += 1
$PlayOn = 0
_Play()
EndIf
EndIf
EndFunc
Func _StartStop()
If $ButtonSend Then
$Input = "2"
Else
$Input = InputBox("Abspielen", "Gebe: '1' oder '2' ein um eine Playlist oder nur ein Lied abzuspielen!")
If @error Then
MsgBox(64, "Information", "Der Vorgang wurde abgebrochen!")
Return 0
EndIf
EndIf
If $Input = "2" Then
$ButtonSend = Not $ButtonSend
If $ButtonSend Then
GUICtrlSetData($Button2, "Pause")
_SoundPlay($Open)
Else
GUICtrlSetData($Button2, "Play")
_SoundPause($Open)
EndIf
ElseIf $Input = "1" Then
$ReadSections = IniReadSectionNames(@ScriptDir & "\Playlist.tke")
If UBound($ReadSections) -1 <= 0 Then
MsgBox(64, "Information", "Keine Playlist gefunden!")
Return 0
Else
For $iSec = 1 To UBound($ReadSections) -1
$Txt &= $ReadSections[$iSec] & @CRLF
Next
$Play = InputBox("Name", "Gib den Playlistname ein: " & $Txt)
If @error Or $Play = "" Then
MsgBox(64, "Information", "Abgebrochen oder Leer!")
Return 0
EndIf
If StringInStr($Txt, $Play) Then
$Playlistplay = $Play
$PlayYet = 0
AdlibRegister("_PlayPlaylist",1000)
Else
MsgBox(64, "Information", "Playlist nicht gefunden!")
Return 0
EndIf
EndIf
Else
MsgBox(64, "Information", "Falsche eingabe!")
EndIf
EndFunc ;==>_StartStop
Func _StopMusik()
_SoundStop($Open)
_SoundClose($Open)
EndFunc ;==>_StopMusik
Func _OpenMusik()
$Path = FileOpenDialog("", @UserProfileDir & "\Music", "(*.mp3)", 1)
GUICtrlSetData($Label1, $Path)
$Open = _SoundOpen($Path)
EndFunc ;==>_OpenMusik
Func _DeletPlaylist()
If FileExists(@ScriptDir & "\Playlist.tke") Then
FileDelete(@ScriptDir & "\Playlist.tke")
MsgBox(64, "Information", "Playlist.tke erfolgreich gelöscht!")
Else
MsgBox(64, "Information", "Playlist.tke kann nicht gelöscht werden!")
EndIf
EndFunc ;==>_DeletPlaylist
Func _Play()
$Maximale_Laenge = _SoundLength($Open, 2) ;Lässt den Balken so Laden das wenn die Musik zu Ende ist der Balken voll ist.
$Aktuelle_Position = _SoundPos($Open, 2)
$Fortschritt = Int($Aktuelle_Position * 100 / $Maximale_Laenge)
GUICtrlSetData($Progress1, $Fortschritt)
EndFunc ;==>_Play
Func _CreatePlayList()
$Files = FileOpenDialog("Wähle die Lieder aus!", "", "MP3 (*.mp3)", 1 + 4, ".mp3")
If @error Then
MsgBox(64, "Information", "Abgebrochen!")
Return 0
EndIf
While True
$rtn = 0
$fSplit = StringSplit($Files, "|", 2)
If UBound($fSplit) - 1 < 2 Then
MsgBox(64, "Information", "Eine Playlist hat mindestens 2 Lieder!")
Return 0
EndIf
$InputName = InputBox("Name", "Gib den Name der Playlist ein!")
If @error Or $InputName = "" Then
MsgBox(64, "Information" , "Abgebrochen oder Leer!")
Return 0
EndIf
If FileExists(@ScriptDir & "\Playlist.tke") Then
$Sections = IniReadSectionNames(@ScriptDir & "\Playlist.tke")
For $i = 1 To UBound($Sections)-1
If $InputName = $Sections[$i] Then
MsgBox(64, "Information", "Der Name ist bereits vorhanden!")
$rtn = 1
EndIf
Next
EndIf
If $rtn <> 1 Then
ExitLoop
EndIf
WEnd
For $i = 1 To UBound($fSplit) - 1
IniWrite(@ScriptDir & "\Playlist.tke", $InputName, "Lied" & $i - 1, $fSplit[0] & "\" & $fSplit[$i])
Next
MsgBox(64, "Information", "Playlist erfolgreich erstellt!")
EndFunc ;==>_CreatePlayList
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) ;Return
If ($hWnd = $Form1) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST