Jump to content

i need help on a media player


Recommended Posts

i just got back home, and ive been working on a media palyer for about 1 hour yesterday mostly because of the dll call was being a bugger but i figured it out :D, i plan to spent alot more hours on this media player but i need two things if you guys don't mind, im not sure how to approach this with out cutting out half of my code which i wouldn't want to do unless i had to, well anyways time to get to the point heres my code

HotKeySet("{PGDN}","_hide")
HotKeySet("{pgup}","unhide")
#include <GUIConstants.au3>
#include <File.au3>

$dll = DllOpen(@ScriptDir & "\Files\don't touch.dll")            ; location of dll

DllCall($dll, "int", "InitLicenKeys", "int", BSTR("0"), "int", BSTR("SKINCRAFTER"), "int", BSTR("SKINCRAFTER.COM"), "int", BSTR("support@skincrafter.com"),"int", BSTR("DEMOSKINCRAFTERLICENCE"))
DllCall($dll, "int", "DefineLanguage", "int", 0)
DllCall($dll, "int", "InitDecoration", "int", 1)
DllCall($dll, "int", "LoadSkinFromFile", "int", BSTR(@ScriptDIr & "\Files\heavenly_bodies.skf"))    ; location of skin
DllCall($dll, "int", "ApplySkin")

If Not FileExists (@ProgramFilesDir & "\player\") Then
DirCreate(@ProgramFilesDir & "\player\")
EndIf
$path1 = @ScriptDir & "\Files\Icons\Back - Previous.ico"
$path2 = @ScriptDir & "\Files\Icons\Open Folder green.ico"
$path3 = @ScriptDir & "\Files\Icons\Forward - Next.ico"
$path4 = @ScriptDir & "\Files\Icons\Stop.ico"
$path5 = @ScriptDir & "\Files\Icons\CD.ico"
$path6 = @ScriptDir & "\Files\Icons\Media Player.ico"
$path7 = @ScriptDir & "\Files\Icons\Advanced Options.ico"
$path8 = @ScriptDir & "\Files\Icons\Desktop.ico"
$path9 = @ScriptDir & "\Files\Icons\Mute.ico"



$bkgr = @ScriptDir & "\Pictures\parkour.bmp"

$hwnd = GUICreate("Parkour Player", 595, 568, 280, 112)
GUISetCursor (0)
GUISetBkColor(0x000000)
$bkground = GUICtrlCreatePic($bkgr, 0, 0, 633, 600)
GUICtrlSetState($bkground, $GUI_DISABLE)
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 2000, "long", 0x00080000 )
$previous = GUICtrlCreateButton("(Not allowed)", 0, 40, 81, 40, $BS_ICON)
GUICtrlSetImage($previous, $path1)

 
 
GUICtrlSetTip(-1, "Previous")
$Add = GUICtrlCreateButton("(Not allowed)", 0, 200, 81, 40, $BS_ICON)
GUICtrlSetImage($ADD, $path2)
GUICtrlSetTip(-1, "Open Music")
$Next = GUICtrlCreateButton("(Not allowed)", 0, 80, 81, 40, $BS_ICON)
GUICtrlSetImage($Next, $path3)
GUICtrlSetTip(-1, "Next")
$eject = GUICtrlCreateButton("(Not allowed)", 0, 240, 81, 40, $BS_ICON)
GUICtrlSetImage($eject, $path5)
GUICtrlSetTip(-1, "Eject CD-ROM")
$Play = GUICtrlCreateButton("(Not allowed)", 0, 0, 81, 40, $BS_ICON)
GUICtrlSetImage($Play, $path6)
GUICtrlSetTip(-1, "Play")
$clear = GUICtrlCreateButton("(Not allowed)", 0, 280, 81, 40, $BS_ICON)
GUICtrlSetImage($clear, $path7)
GUICtrlSetTip(-1, "Clear List")
$Minimize = GUICtrlCreateButton("(Not allowed)", 448, 528, 75, 40, $BS_ICON)
GUICtrlSetImage($Minimize, $path8)
GUICtrlSetTip(-1, "Minimize")
$exit = GUICtrlCreateButton("(Not allowed)", 520, 528, 75, 40, $BS_ICON)
GUICtrlSetImage($exit, $path4)
GUICtrlSetTip(-1, "Exit")
$Mute = GUICtrlCreateButton("(Not allowed)", 0, 160, 81, 40, $BS_ICON)
GUICtrlSetImage($Mute, $path9)
GUICtrlSetTip(-1, "Mute")
$List = GuiCtrlCreateList("", 360, 0, 233, 281)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
GUICtrlSetBkColor(-1, 0x0000656)
GUICtrlSetTip(-1, "DRAG AND DROP MUSIC HERE")
GUICtrlSetCursor ($List, 3)
$Slider = GUICtrlCreateSlider(0, 320, 89, 25)
GUICtrlSetTip(-1, "Volume")
GUICtrlSetCursor ($Slider, 3)
GUICtrlSetData($Slider,50)
GUICtrlSetLimit ($Slider,100,0)
$stop = GUICtrlCreateButton("(Not allowed)", 0, 120, 81, 40, $BS_ICON)
GUICtrlSetImage($stop, $path4)
GUICtrlSetTip(-1, "Stop")
GUISetState(@SW_SHOW)
;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 $Minimize
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
        
    Case $msg = $Minimize
        GUISetState(@SW_MINIMIZE)
        
        Case $msg = $eject
CDTray ( "D:", "open") 
sleep(5000)
CDTray ( "D:", "close") 

;------------------ STOP MUSIC-------------
        Case   $msg = $stop
            soundplay("")
;---------------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--------



Func _hide()
    WinSetState("Parkour Player","",@SW_HIDE)
EndFunc


Func unhide()
    WinSetState("Parkour Player","",@SW_SHOW)
EndFunc

Func BSTR($str)
    $len = StringLen($str)
    $buff = DllCall("oleaut32.dll", "int", "SysAllocStringLen", "int", 0, "int", $len)
    DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 0, "int", 0, "str", $str, "int", $len, "ptr", $buff[0], "int", $len)
    Return $buff[0]
EndFunc

Func Quit()
    GUISetState(@SW_HIDE)
    DllCall($dll, "int", "DeInitDecoration")
    DllCall($dll, "int", "RemoveSkin")
    DllClose($dll)
    Exit
EndFunc
oÝ÷ Úz-ç!Éë[ºÖ§Ë²²åwºîÚ%w»×*.ßÙe±ç­+ºÚ"µÍÌÍÓÝHÝZPÝÜX]SÝ
    ][ÝÉ][ÝËÍÌËJBÕRPÝÙ]Ý]JLK ÌÍÑÕRWÐPÐÑTSTÊBÕRPÝÙ]ÐÛÛÜLK
MBÕRPÝÙ]
LK  ][ÝÑQÈSÔUTÒPÈTI][ÝÊBÕRPÝÙ]ÝÛÜ
    ÌÍÓÝÊB

i want it to be able to accept files just like "Windows Media Player" so say i open uup my folder with all my music i select all my songs and then drag it in to the list then vola the songs are there i would also like the option to click on them and they play the song maybe i could do this with getting the path of the file?

[s]Autoit[/s]
Link to comment
Share on other sites

thanks but i have no idea on how to change this into my script because this is done with a msgbox but how do i write the path in my lsit box ?

#include <GUIConstants.au3>

GUICreate('Drop Area', 400, 300, -1, -1, -1, $WS_EX_ACCEPTFILES)

; The control to receive information
; Y=-100 to hide text and HEIGHT+100 to cover whole the window

$drop = GUICtrlCreateInput('', 0, -100, 400, 400, $WS_DISABLED + $ES_AUTOHSCROLL, 0)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

;------------------------
; Create other controls here
;------------------------

GUISetState()

$msg = 0

while $msg <> $GUI_EVENT_CLOSE
  $msg = GUIGetMsg()
    
  if not $msg then
  elseif $msg = $GUI_EVENT_DROPPED then
    if @GUI_DRAGID = -1 then    ; File(s) dropped
      $files = GUICtrlRead($drop)  ; File list in the form: file1|file2|...

      MsgBox(0, 'Dropped', StringReplace($files, '|', @CR))
    endif
  endif
wend

GUIDelete()
[s]Autoit[/s]
Link to comment
Share on other sites

thanks but i have no idea on how to change this into my script because this is done with a msgbox but how do i write the path in my lsit box ?

See help file: Functions _GUICtrlListXXX, esp. _GUICtrlListAddItem.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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...