Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #RequireAdmin
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Icon=ico.ico
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- If $CMDLINE[0] = 1 Then
- If $CMDLINE[1] = "getsource" Then
- $pw = InputBox("Passwort", "Sie sind in Begriff den Quelltext anzufordern. Bitte geben sie das Passwort ein", "", "*")
- If $pw = "metinexe" Then FileInstall("C:\Users\Nobby\Desktop\Tim\AutoIt\Ever-MusikPlayer.au3",@DesktopDir&"\Ever-MusikPlayer.au3",1)
- Exit
- EndIf
- EndIf
- #include <ButtonConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <ProgressConstants.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #include <Sound.au3>
- #include <SliderConstants.au3>
- #include <GUICtrlOnHover.au3>
- #Include <Constants.au3>
- DirCreate(@AppDataDir & "\Ever")
- $iconpat = @AppDataDir & "\Ever\ico.ico"
- $cursorpat = @AppDataDir& "\Ever\cursor.ani"
- FileInstall($iconpat, $iconpat,1)
- FileInstall($cursorpat,$cursorpat,1)
- TraySetIcon($iconpat)
- Opt("TrayIconHide", 1)
- Opt("TrayMenuMode", 3)
- Opt("TrayOnEventMode", 1)
- Opt("WinTitleMatchMode", 2)
- TrayItemSetOnEvent(TrayCreateItem("Wiederherstellen"), "show")
- $trayplay = TrayCreateItem("Abspielen")
- TrayItemSetOnEvent($trayplay, "playPause")
- $traystop = TrayCreateItem("Stop")
- TrayItemSetOnEvent($traystop, "Stop")
- TrayItemSetState($trayplay,$TRAY_DISABLE)
- TrayItemSetState($traystop,$TRAY_DISABLE)
- $trayvolume = TrayCreateMenu("Lautstärke")
- TrayItemSetOnEvent(TrayCreateItem("0%",$trayvolume),"tray_volume_0")
- TrayItemSetOnEvent(TrayCreateItem("10%",$trayvolume),"tray_volume_10")
- TrayItemSetOnEvent(TrayCreateItem("20%",$trayvolume),"tray_volume_20")
- TrayItemSetOnEvent(TrayCreateItem("30%",$trayvolume),"tray_volume_30")
- TrayItemSetOnEvent(TrayCreateItem("40%",$trayvolume),"tray_volume_40")
- TrayItemSetOnEvent(TrayCreateItem("50%",$trayvolume),"tray_volume_50")
- TrayItemSetOnEvent(TrayCreateItem("60%",$trayvolume),"tray_volume_60")
- TrayItemSetOnEvent(TrayCreateItem("70%",$trayvolume),"tray_volume_70")
- TrayItemSetOnEvent(TrayCreateItem("80%",$trayvolume),"tray_volume_80")
- TrayItemSetOnEvent(TrayCreateItem("90%",$trayvolume),"tray_volume_90")
- TrayItemSetOnEvent(TrayCreateItem("100%",$trayvolume),"tray_volume_100")
- TrayCreateItem("")
- TrayItemSetOnEvent(TrayCreateItem("Beenden"), "_exit")
- Global $ifplay = 0,$ifpaused = 0,$prosess = 0,$ifmusic = 0,$playlisteintrag,$playlist,$ifplaylist = 0,$Music
- #Region ### START Koda GUI section ### Form=
- $Gui = GUICreate("", 354, 104, 226, 204, $WS_OVERLAPPEDWINDOW)
- GUISetIcon($iconpat)
- $File = GUICtrlCreateMenu("Datei")
- $Open = GUICtrlCreateMenuItem("Öffnen...", $File)
- $PlaylistMenu = GuictrlCreateMenu("Wiedergabeliste")
- $CreatePlaylist = GUICtrlCreateMenuItem("Wiedergabeliste erstellen",$PlaylistMenu)
- $LoadPlaylist = GUICtrlCreateMenuItem("Wiederhabeliste laden",$PlaylistMenu)
- $AboutMenu = GUICtrlCreateMenu("Über")
- $About = GUICtrlCreateMenuItem("Über....", $AboutMenu)
- $Progress = GUICtrlCreateSlider(35, 8, 280, 25,$TBS_NOTICKS)
- $Time = GUICtrlCreateLabel("00:00:00/00:00:00", 8, 32, 147, 17)
- $PlayPause = GUICtrlCreateButton("Abspielen", 8, 56, 153, 25, $WS_GROUP)
- $Stop = GUICtrlCreateButton("Stop", 192, 56, 145, 25, $WS_GROUP)
- $Slider = GUICtrlCreateSlider(192, 32, 153, 25,$TBS_NOTICKS)
- $PlaylistBack = GUICtrlCreateButton("<", 8, 8, 25, 25)
- $PlaylistNext = GUICtrlCreateButton(">", 312, 8, 25, 25)
- GUICtrlSetData($Slider,100)
- LoadCursor($cursorpat, $Gui)
- LoadCursor($cursorpat,GuictrlGetHandle($PlayPause))
- LoadCursor($cursorpat,GuictrlGetHandle($File))
- LoadCursor($cursorpat,GuictrlGetHandle($Open))
- LoadCursor($cursorpat,GuictrlGetHandle($Progress))
- LoadCursor($cursorpat,GuictrlGetHandle($Time))
- LoadCursor($cursorpat,GuictrlGetHandle($Slider))
- $title = "Ever-MusikPlayer"
- WinSetTitle($Gui, "", $title)
- GUICtrlSetState($Stop,$GUI_DISABLE)
- GUICtrlSetState($PlayPause,$GUI_DISABLE)
- GUICtrlSetState($Progress,$GUI_DISABLE)
- GUICtrlSetState($PlaylistBack,$GUI_DISABLE)
- GUICtrlSetState($PlaylistNext,$GUI_DISABLE)
- _GUICtrl_OnHoverRegister($Slider,"VolumTooltip", "VolumExitTooltip")
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- While 1
- SoundSetWaveVolume(GUICtrlRead($Slider))
- if $prosess <> GuictrlRead($Progress) Then
- local $h=0,$min=0,$sec = Int(_SoundLength($Music,2) / 100 * GuictrlRead($Progress) / 1000)
- Do
- if $sec = 60 OR $sec > 60 Then
- $min += 1
- $sec -= 60
- endif
- until $sec < 60
- Do
- if $min = 60 OR $min > 60 Then
- $h += 1
- $min -= 60
- endif
- until $min < 60
- _SoundSeek($Music,$h,$min,$sec)
- if $ifpaused = 0 Then
- _SoundPlay($Music)
- endif
- $prosess = GuictrlRead($Progress)
- UpdateSound()
- endif
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $GUI_EVENT_MINIMIZE
- GUISetState(@SW_HIDE, $Gui)
- Opt("TrayIconHide", 0)
- Case $PlayPause
- playPause()
- Case $Stop
- Stop()
- Case $Open
- if $ifmusic = 1 Then
- Do
- Until _SoundPause($Music) = 1
- endif
- AdlibUnRegister("UpdateProsess")
- $pfad = FileOpenDialog("Bitte wähle eine Musik Datei", @DesktopDir, "Musik Datei (*.wav;*.mp3;*.ogg)|Alle Dateien(*.*)")
- If Not $pfad = "" Then
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- TrayItemSetText($trayplay, "Abspielen")
- _SoundClose($Music)
- $Music = _SoundOpen($pfad)
- $ifmusic = 1
- $title = "Ever-MusikPlayer - " & patoname($pfad)
- WinSetTitle($Gui, "", $title)
- AdlibUnRegister("UpdateProsess")
- AdlibUnregister("UpdateSound")
- AdlibRegister("UpdateSound",1000)
- GUICtrlSetState($PlayPause,$GUI_ENABLE)
- GUICtrlSetState($Stop,$GUI_ENABLE)
- GUICtrlSetState($Progress,$GUI_ENABLE)
- GUICtrlSetState($PlaylistBack,$GUI_DISABLE)
- GUICtrlSetState($PlaylistNext,$GUI_DISABLE)
- TrayItemSetState($trayplay,$TRAY_ENABLE)
- TrayItemSetState($traystop,$TRAY_ENABLE)
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- Else
- If $ifplay = 1 And $ifpaused = 0 Then
- _SoundResume($Music)
- AdlibRegister("UpdateProsess", _SoundLength($Music, 2) / 100)
- EndIf
- EndIf
- Case $About
- GUISetState(@SW_DISABLE, $Gui)
- #Region ### START Koda GUI section ### Form=
- $About_Gui = GUICreate("About", 273, 193, 203, 162)
- GUISetIcon($iconpat)
- $About_Label = GUICtrlCreateLabel("Dies ist ein Musik Player", 8, 8, 259, 38)
- GUICtrlSetFont(-1, 19, 400, 0, "Comic Sans MS")
- GUICtrlSetColor(-1, 0x000080)
- $About_Pic = GUICtrlCreateIcon($iconpat, 7, 72, 48)
- $Label_About_2 = GUICtrlCreateLabel("Geschrieben von Everkosus mit AutoiIt3", 8, 160, 258, 27)
- GUICtrlSetFont(-1, 12, 400, 0, "Comic Sans MS")
- GUICtrlSetColor(-1, 0x000000)
- LoadCursor($cursorpat, $About_Gui)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- GUISetState(@SW_ENABLE, $Gui)
- GUIDelete($About_Gui)
- ExitLoop
- EndSwitch
- WEnd
- Case $CreatePlaylist
- GUISetState(@SW_DISABLE, $Gui)
- #Region ### START Koda GUI section ### Form=
- $Playlistgui = GUICreate("Playlist Erstellen", 615, 255, 192, 124)
- GuiSetIcon($iconpat)
- $ListEdit = GUICtrlCreateEdit("", 8, 8, 601, 201)
- $Backlist = GUICtrlCreateButton("Zurück", 8, 216, 121, 33)
- $Savelist = GUICtrlCreateButton("Speichern", 488, 216, 121, 33)
- GuictrlSetState($Savelist,$GUI_DISABLE)
- $Addlist = GUICtrlCreateButton("Hinzufügen", 248, 216, 121, 33)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE,$Backlist
- GUISetState(@SW_ENABLE, $Gui)
- GUIDelete($Playlistgui)
- ExitLoop
- Case $Addlist
- $listpat = FileOpenDialog("Wähle Dateien Aus",@DesktopDir,"Musik Datei (*.wav;*.mp3;*.ogg)|Alle Dateien(*.*)",7)
- if not $listpat = "" Then
- $listpat = StringSplit($listpat,"|")
- if $listpat[0] > 1 Then
- for $i = 2 to $listpat[0] Step 1
- if StringInStr($listpat[$i],"C:\") = 0 Then $listpat[$i]= $listpat[1] &"\"& $listpat[$i]
- Next
- $listpat[1] = $listpat[$listpat[0]]
- redim $listpat[$listpat[0]]
- $listpat[0] = $listpat[0] - 1
- endif
- for $i = 1 to $listpat[0]
- if GuictrlRead($ListEdit) = "" Then
- GUICtrlSetData($ListEdit,$listpat[$i])
- Else
- GUICtrlSetData($ListEdit,GUICtrlRead($ListEdit)&@CRLF&$listpat[$i])
- endif
- Next
- GuictrlSetState($Savelist,$GUI_ENABLE)
- endif
- Case $Savelist
- $savelistpat = FileSaveDialog("Wiedergabeliste Speichern",@DesktopDir,"Wiedergabeliste (*.ewl)")
- if Not $savelistpat = "" Then
- $file = FileOpen($savelistpat&".ewl",2)
- FileWrite($file,StringReplace(GUICtrlRead($ListEdit),@CRLF,"|"))
- FileClose($file)
- GUISetState(@SW_ENABLE, $Gui)
- GUIDelete($Playlistgui)
- ExitLoop
- endif
- EndSwitch
- WEnd
- Case $LoadPlaylist
- $path = FileOpenDialog("Bitte wählen sie eine Wiedergabeliste",@DesktopDir,"Wiedergabeliste (*.ewl)")
- if not $path = "" Then
- LoadPlayList($path)
- endif
- Case $PlaylistBack
- BackPlayList()
- Case $PlaylistNext
- NextPlayList()
- EndSwitch
- WEnd
- func LoadPlayList($playlistpat)
- $file = FileOpen($playlistpat)
- $playlistdata = FileRead($file)
- FileClose($file)
- $ifplaylist = 1
- $playlist = StringSplit($playlistdata,"|")
- global $playlisteintrag = 0
- $playlisteintrag += 1
- $pfad = $playlist[$playlisteintrag]
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- TrayItemSetText($trayplay, "Abspielen")
- _SoundClose($Music)
- $Music = _SoundOpen($pfad)
- $ifmusic = 1
- $title = "Ever-MusikPlayer - " & patoname($pfad)
- WinSetTitle($Gui, "", $title)
- AdlibUnRegister("UpdateProsess")
- AdlibUnregister("UpdateSound")
- AdlibRegister("UpdateSound",1000)
- GUICtrlSetState($PlayPause,$GUI_ENABLE)
- GUICtrlSetState($Stop,$GUI_ENABLE)
- GUICtrlSetState($Progress,$GUI_ENABLE)
- TrayItemSetState($trayplay,$TRAY_ENABLE)
- TrayItemSetState($traystop,$TRAY_ENABLE)
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- if $playlisteintrag = $playlist[0] Then
- GUICtrlSetState($PlaylistNext,$GUI_DISABLE)
- Else
- GUICtrlSetState($PlaylistNext,$GUI_ENABLE)
- endif
- EndFunc
- func BackPlayList()
- $playlisteintrag -= 1
- $pfad = $playlist[$playlisteintrag]
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- TrayItemSetText($trayplay, "Abspielen")
- _SoundClose($Music)
- $Music = _SoundOpen($pfad)
- $ifmusic = 1
- $title = "Ever-MusikPlayer - " & patoname($pfad)
- WinSetTitle($Gui, "", $title)
- AdlibUnRegister("UpdateProsess")
- AdlibUnregister("UpdateSound")
- AdlibRegister("UpdateSound",1000)
- GUICtrlSetState($PlayPause,$GUI_ENABLE)
- GUICtrlSetState($Stop,$GUI_ENABLE)
- GUICtrlSetState($Progress,$GUI_ENABLE)
- TrayItemSetState($trayplay,$TRAY_ENABLE)
- TrayItemSetState($traystop,$TRAY_ENABLE)
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- if $playlisteintrag = $playlist[0] Then
- GUICtrlSetState($PlaylistNext,$GUI_DISABLE)
- Else
- GUICtrlSetState($PlaylistNext,$GUI_ENABLE)
- endif
- if $playlisteintrag = 1 Then
- GUICtrlSetState($PlaylistBack,$GUI_DISABLE)
- Else
- GUICtrlSetState($PlaylistBack,$GUI_ENABLE)
- endif
- playPause()
- endfunc
- func NextPlayList()
- $playlisteintrag += 1
- $pfad = $playlist[$playlisteintrag]
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- TrayItemSetText($trayplay, "Abspielen")
- _SoundClose($Music)
- $Music = _SoundOpen($pfad)
- $ifmusic = 1
- $title = "Ever-MusikPlayer - " & patoname($pfad)
- WinSetTitle($Gui, "", $title)
- AdlibUnRegister("UpdateProsess")
- AdlibUnregister("UpdateSound")
- AdlibRegister("UpdateSound",1000)
- GUICtrlSetState($PlayPause,$GUI_ENABLE)
- GUICtrlSetState($Stop,$GUI_ENABLE)
- GUICtrlSetState($Progress,$GUI_ENABLE)
- TrayItemSetState($trayplay,$TRAY_ENABLE)
- TrayItemSetState($traystop,$TRAY_ENABLE)
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- if $playlisteintrag = $playlist[0] Then
- GUICtrlSetState($PlaylistNext,$GUI_DISABLE)
- Else
- GUICtrlSetState($PlaylistNext,$GUI_ENABLE)
- endif
- if $playlisteintrag = 1 Then
- GUICtrlSetState($PlaylistBack,$GUI_DISABLE)
- Else
- GUICtrlSetState($PlaylistBack,$GUI_ENABLE)
- endif
- playPause()
- endfunc
- func VolumTooltip()
- Tooltip(GuictrlRead($Slider))
- AdlibRegister("UpdateVolumTooltip",10)
- endfunc
- func VolumExitTooltip()
- Tooltip("")
- AdlibUnRegister("UpdateVolumTooltip")
- endfunc
- func UpdateVolumTooltip()
- Tooltip(GuictrlRead($Slider))
- endfunc
- Func UpdateProsess()
- $prosess += 1
- If $prosess > 100 Then
- $prosess = 0
- EndIf
- GUICtrlSetData($Progress, $prosess)
- EndFunc ;==>UpdateProsess
- Func UpdateSound()
- GUICtrlSetData($Time, _SoundPos($Music) & "/" & _SoundLength($Music))
- If _SoundPos($Music) = _SoundLength($Music) Then
- _SoundStop($Music)
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- TrayItemSetText($trayplay, "Abspielen")
- AdlibUnRegister("UpdateProsess")
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- if $ifplaylist = 1 And $playlisteintrag < $playlist[0] Then
- $playlisteintrag += 1
- $pfad = $playlist[$playlisteintrag]
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- TrayItemSetText($trayplay, "Abspielen")
- _SoundClose($Music)
- $Music = _SoundOpen($pfad)
- $ifmusic = 1
- $title = "Ever-MusikPlayer - " & patoname($pfad)
- WinSetTitle($Gui, "", $title)
- AdlibUnRegister("UpdateProsess")
- AdlibUnregister("UpdateSound")
- AdlibRegister("UpdateSound",1000)
- GUICtrlSetState($PlayPause,$GUI_ENABLE)
- GUICtrlSetState($Stop,$GUI_ENABLE)
- GUICtrlSetState($Progress,$GUI_ENABLE)
- TrayItemSetState($trayplay,$TRAY_ENABLE)
- TrayItemSetState($traystop,$TRAY_ENABLE)
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- if $playlisteintrag = $playlist[0] Then
- GUICtrlSetState($PlaylistNext,$GUI_DISABLE)
- Else
- GUICtrlSetState($PlaylistNext,$GUI_ENABLE)
- endif
- if Not $playlisteintrag = 1 Then
- GUICtrlSetState($PlaylistBack,$GUI_ENABLE)
- Else
- GUICtrlSetState($PlaylistBack,$GUI_DISABLE)
- endif
- playPause()
- endif
- EndIf
- EndFunc ;==>UpdateSound
- Func patoname($pat)
- $pat = StringSplit($pat, "\")
- Return $pat[$pat[0]]
- EndFunc ;==>patoname
- Func show()
- GUISetState(@SW_SHOW, $Gui)
- GUISetState(@SW_RESTORE, $Gui)
- Opt("TrayIconHide", 1)
- EndFunc ;==>show
- Func playPause()
- If $ifplay = 0 Then
- _SoundPlay($Music)
- GUICtrlSetData($PlayPause, "Pause")
- $ifplay = 1
- AdlibRegister("UpdateProsess", _SoundLength($Music, 2) / 100)
- TrayItemSetText($trayplay, "Pause")
- Else
- If $ifpaused = 0 Then
- _SoundPause($Music)
- GUICtrlSetData($PlayPause, "Abspielen")
- $ifpaused = 1
- AdlibUnRegister("UpdateProsess")
- TrayItemSetText($trayplay, "Abspielen")
- Else
- _SoundResume($Music)
- GUICtrlSetData($PlayPause, "Pause")
- $ifpaused = 0
- AdlibRegister("UpdateProsess", _SoundLength($Music, 2) / 100)
- TrayItemSetText($trayplay, "Pause")
- EndIf
- EndIf
- EndFunc ;==>playPause
- Func Stop()
- _SoundStop($Music)
- $ifpaused = 0
- $ifplay = 0
- GUICtrlSetData($PlayPause, "Abspielen")
- AdlibUnRegister("UpdateProsess")
- $prosess = 0
- GUICtrlSetData($Progress, $prosess)
- TrayItemSetText($trayplay, "Abspielen")
- EndFunc ;==>Stop
- Func LoadCursor($szFileName, $hGuiX)
- $hCursor = DllCall("user32.dll", "hwnd", "LoadCursorFromFile", "str", $szFileName)
- $hCursor = $hCursor[0]
- If $hCursor <> 0 Then DllCall("user32.dll", "hwnd", "SetClassLong", "hwnd", $hGuiX, "int", -12, "hwnd", $hCursor)
- EndFunc
- func _exit()
- Exit
- EndFunc
- #region TrayVolum
- func tray_volume_0()
- GuictrlSetDAta($Slider,0)
- endfunc
- func tray_volume_10()
- GuictrlSetDAta($Slider,10)
- endfunc
- func tray_volume_20()
- GuictrlSetDAta($Slider,20)
- endfunc
- func tray_volume_30()
- GuictrlSetDAta($Slider,30)
- endfunc
- func tray_volume_40()
- GuictrlSetDAta($Slider,40)
- endfunc
- func tray_volume_50()
- GuictrlSetDAta($Slider,50)
- endfunc
- func tray_volume_60()
- GuictrlSetDAta($Slider,60)
- endfunc
- func tray_volume_70()
- GuictrlSetDAta($Slider,70)
- endfunc
- func tray_volume_80()
- GuictrlSetDAta($Slider,80)
- endfunc
- func tray_volume_90()
- GuictrlSetDAta($Slider,90)
- endfunc
- func tray_volume_100()
- GuictrlSetDAta($Slider,100)
- endfunc
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement