Jump to content

Another Music Player Again


Thatsgreat2345
 Share

Recommended Posts

Yes here is once again another music player :P

#include <GuiConstants.au3>
#include <File.au3>
If Not FileExists (@ProgramFilesDir & "\Thatsgreat2345\") Then
DirCreate(@ProgramFilesDir & "\Thatsgreat2345\")
EndIf
;--------------------------------------GUI START--------------------------------------------------------

GUICreate("Music Player V 1.1", 450, 400, 192, 125)
GUISetCursor (0)
GUISetBkColor(0x000000)
$List = GuiCtrlCreateList("", 150, 220, 275, 175)
$Add = GuiCtrlCreateButton("Add", 60, 240, 60, 20)
GUICtrlSetLimit(-1,200); to limit horizontal scrolling
$clear = GuiCtrlCreateButton("Clear", 60, 270, 60, 20)
$Play = GuiCtrlCreateButton("Play", 10, 10, 50, 20)
$Next = GuiCtrlCreateButton("Next", 70, 10, 50, 20)
$Mute = GuiCtrlCreateButton("Mute", 190, 10, 50, 20)
$stop = GuiCtrlCreateButton("Stop", 250, 10, 50, 20)
$exit = GuiCtrlCreateButton("Exit", 310, 10, 50, 20)
$previous = GuiCtrlCreateButton("Previous", 130, 10, 50, 20)
$slider = GUICtrlCreateSlider (150,50,100,40)
GUICtrlSetData($Slider,100)
GUICtrlSetLimit ($Slider,100,0)
$Label_8 = GuiCtrlCreateLabel("Thatsgreat2345", 10, 50, 80, 20)
GUICtrlSetResizing (-1,$GUI_DOCKLEFT)


;opens the playlist and then puts all the songs in the playlist file in the listbox
$filehandle = Fileopen(@ProgramFilesDir & "\Thatsgreat2345\Playlist.txt",0)

while 1
Local $Line = FileReadLine($filehandle)
    If @error Then ExitLoop
    GUICtrlSetData($list, $Line & "|")
Wend

Fileclose($filehandle)

GuiSetState()
;---------------------------------------GUI END---------------------------------------------------------
;----------------------------------DIM VARS-------------------------
Dim $play
Dim $Mute
dim $stop
Dim $exit
Dim $slider
DIm $msg
Dim $playlist
Dim $list
Dim $file
Dim $line
DIm $previous
dim $playlistpath = @ProgramFilesDir & "\Thatsgreat2345\Playlist.txt"
dim $songlistpath = @ProgramFilesDir & "\Thatsgreat2345\song.txt"
Global $linenumber = 1
;--------------DIM END
func stop()
    while 1
        sleep(100)
    wend
endfunc;==>stop
;-------------start--------------------
Do
    
    $msg = GUIGetMsg ()
    Select
;------------------ STOP MUSIC-------------
        Case   $msg = $stop
            soundplay("C:\exit.mp3")
  ;---------------END STOP MUSIC---------
  ;--------- PLAY MUSIC ---------
        Case $msg = $play
            $line = FileReadLine($playlistpath, $linenumber)
            FileDelete($songlistpath)
          ;FileInstall("C:\Documents and Settings\NEON\Desktop\song.txt", $songlistpath)
            _FileCreate($songlistpath)
            FileWrite($songlistpath, $line & @CRLF)
            Soundplay ($line)
  ;---------END PLAY MUSIC------
            
  ;--------------------------mute---------------
        Case $msg = $Mute
            send("{VOLUME_MUTE}")
  ;-----------END MUTE--------------
  ;------------------volume----------------
        Case $msg = $slider
            SoundSetWaveVolume (GUICtrlRead($slider))
  ;-------------END VOLUME---------------
  ;-------------------ADD SONG---------------
        Case $msg = $ADD
            $playlist=FileOpenDialog ("Choose music", "", "Musicfiles(*.mp3;*.wma;*.wav;*.wave;*.mid;*)")
            If not @error Then
                FileWrite($playlistpath, $playlist & @CRLF)
                GUICtrlSetData($list, $playlist)
            Endif
  ;-----------------END ADD SONG --------------------
  ;---------------------CLEAR SONG-------------------
        case $msg = $clear
            GUICtrlSetData($list,"")
            FileDelete($playlistpath)
          ;FileInstall("C:\Documents and Settings\NEON\Desktop\Playlist.txt", $playlistpath)
            _FileCreate($playlistpath)
  ;---------------------- END CLEAR SONG--------------------
  ;----------------------NEXT SONG----------------
        Case $msg = $Next
            If $linenumber <> _FileCountLines($playlistpath) Then
                $linenumber = $linenumber + 1
                $line = FileReadLine($playlistpath, $linenumber)
                FileDelete($songlistpath)
                _FileCreate($songlistpath)
           ; FileInstall("C:\Documents and Settings\NEON\Desktop\song.txt", $songlistpath)
                FileWrite($songlistpath, $line & @CRLF)
                Soundplay ($line)
            Endif
  ;------------------END NEXT SONG-----------------------
  ;-----------------PREVIOUS SONG--------------
        Case $msg = $previous
            If $linenumber > 1 Then
                $linenumber = $linenumber - 1
                $line = FileReadLine($playlistpath, $linenumber)
                FileDelete($songlistpath)
           ; FileInstall("C:\Documents and Settings\NEON\Desktop\song.txt", $songlistpath)
                _FileCreate($songlistpath)
                FileWrite($songlistpath, $line & @CRLF)
                soundplay($line)
            Endif
  ;---------------END PREVIOUS SONG----------------------
  ;-------------- EXIT-----------------------
        Case $msg = $exit

            exit
    EndSelect
Until $msg = $GUI_EVENT_CLOSE
;------------- END EXIT--------

thatsgreat2345.rar

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...