Jump to content

MEDIA PLAYER


zeroZshadow
 Share

Recommended Posts

I finealy dare to present........MY MEDIA PLAYER.

it plays wav, mp3 and wma

has a progress bar

volume control

playlist.

hide and show function

tray menu.

and even a PLAY BUTTON!! :lmao:

and more to come.

YOU NEED THE TRAY MENU THING TO MAKE THE SCRIPT WORK!!

CAN BE FOUND IN THE IDEAS FORUM!

#include <GuiConstants.au3>
#notrayicon
TraySetClick(16)
Opt("GUIoneventmode",1)
Opt("OnExitFunc","_write")
Opt("TrayMenuMode",1)
Opt("TrayOnEventMode",1)
Global $songname[500]
Global $song[500]
Global $songGUI[500]
Global $number
Global $timer
Global $timestop
Global $playing = 0
Global $show = 1
$trayplay = TrayCreateItem("Play")
$traystop = TrayCreateItem("Stop")
$trayload = TrayCreateItem("Load")
$trayexit = TrayCreateItem("Exit")
TrayCreateItem("")
$trayshow = TrayCreateItem("Hide")
TraySetState()
$GUIHANDLE = GuiCreate("Media Player", 336, 185,(@DesktopWidth-336)/2, 250,-1,0x00000010)
$Input = GuiCtrlCreateInput("Drag And Drop Media files here.", 120, 10, 210, 20)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$Listname = GUICtrlCreateListView ( "Playlist|path",10,10,100,149)
_Loadplay()
$Slider = GuiCtrlCreateSlider(110, 130, 190, 40)
$Buttonplay = GuiCtrlCreateButton("Play", 120, 30, 70, 30)
$Buttonload = GuiCtrlCreateButton("Load", 195, 30, 70, 30)
$Buttonstop = GuiCtrlCreateButton("Stop", 120, 60, 30, 30)
$Buttonadd = GuiCtrlCreateButton("Add", 150, 60, 30, 30)
$menu = GUICtrlCreateMenu("File")
$menushow = GUICtrlCreateMenuitem("Hide",$menu)
$menuexit = GUICtrlCreateMenuitem("Exit",$menu)
GUICtrlSetData($Slider,100)
GUICtrlSetLimit ($Slider,100,0)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GuiCtrlSetOnEvent($ButtonPlay, "_Play")
GuiCtrlSetOnEvent($Buttonstop, "_Stop")
GuiCtrlSetOnEvent($Buttonadd, "_Add")
GuiCtrlSetOnEvent($Buttonload, "_Load")
GuiCtrlSetOnEvent($menushow, "_Show")
GuiCtrlSetOnEvent($menuexit, "_Exit")
TraySetItemOnEvent($trayplay,"_Play")
TraySetItemOnEvent($traystop,"_stop")
TraySetItemOnEvent($trayload,"_Load")
TraySetItemOnEvent($trayexit,"_Exit")
TraySetItemOnEvent($trayshow,"_Show")
$progbar = GUICtrlCreateProgress(120,90,200,20,$PBS_SMOOTH)
GuiSetState()

While 1
    sleep(10)
    $diff = TimerDiff($timer)
    $progressset = ($diff/$timestop*100)
    if $playing = 1 Then
        If $progressset >= 100 Then
            _play()
        EndIf
    EndIf
    GuiCtrlsetdata($progbar,$progressset,0)
    SoundSetWaveVolume (GUICtrlRead($slider))
WEnd

Func _Exit()
    Exit
EndFunc
Func _play()
    $song = StringSplit (GUICtrlRead($input), "|")
    if $song[0] = 1 Then
        $FileName = '"'&$song[1]&'"'
        mciSendString("Open " & $FileName & " alias MediaFile")
        mciSendString("Set MediaFile time format milliseconds")
        $answer = mciSendString("Status MediaFile length")
        mciSendString("Close MediaFile")
        $timestop = $answer
        $timer = TimerInit()
        SoundPlay($song[1])
    Else
        $FileName = '"'&$song[2]&'"'
        mciSendString("Open " & $FileName & " alias MediaFile")
        mciSendString("Set MediaFile time format milliseconds")
        $answer = mciSendString("Status MediaFile length")
        mciSendString("Close MediaFile")
        $timestop = $answer
        $timer = TimerInit()
        SoundPlay($song[2])
    EndIf
    Global $playing = 1
EndFunc
Func _Stop()
    Global $playing = 0
    $diff = TimerDiff($timer)
    SoundPlay ("")
EndFunc
Func _loadplay()
    $number = IniRead ( "playlist.ini", "NUMBER", "number", "0" )
    If $number > 0 Then
        For $num=1 to $number
            $songname[$num] = IniRead ( "playlist.ini", "NAME", "name"&$num, "Not found" )
            $song[$num] = IniRead ( "playlist.ini", "PATH", "path"&$num, "Not found" )
            $songGUI[$num] = GUICtrlCreateListViewItem ($songname[$num]&"|"&$song[$num],$listname)
        Next
    EndIf
EndFunc

Func _Add()
    $adder = GUICtrlRead($input)
    $check = Stringsplit($adder,"|")
    If $check[0] = 1 Then
        $name = InputBox("Name","What is the songs name? (***.mp3/***.wma..)")
        $number=$number+1
        GUICtrlCreateListViewItem ($name&"|"&$adder,$listname)
        IniWrite ( "playlist.ini", "NUMBER", "number",$number)
        IniWrite ( "playlist.ini", "NAME", "name"&$number,$name)
        IniWrite ( "playlist.ini", "PATH", "path"&$number,$adder)
    Else
        GUICtrlCreateListViewItem ($adder,$listname)
    EndIf
EndFunc
Func mciSendString($string)
   Local $ret
   $ret = DllCall("winmm.dll","int","mciSendString","str",$string,"str","","int",65534,"hwnd",0)
   If Not @error Then Return $ret[2]
EndFunc
   
Func _Load()
    $load = FileOpenDialog("Open",@MyDocumentsDir,"Music Files (*.Wav;*.MP3;*.WMA)")
    if not $load = 1 Then
    GuiCtrlSetData($input,"")
    GuiCtrlSetData($input,$load)
EndIf
_play()
EndFunc

Func _Show()
    If $show = 1 Then
    GuiSetstate(@SW_HIDE,$GUIHANDLE)
    TraySetItemText($trayshow,"Show")
    $Show = 2
Else
    GuiSetstate(@SW_SHOW,$GUIHANDLE)
    TraySetItemText($trayshow,"Hide")
    $Show = 1
EndIf
EndFunc

hope ya like it

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

made a new version

hotkeys added for:

play

stop

load

exit

hide/show

can be used as standert player because of cmd function.

use this as operator :

"C:\Documents and Settings\zeroZshadow\Mijn documenten\autoitscripts\petprogram\CMDmediaplayer.exe" "%L"

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

  • Developers

Tried It. It's not working. Got this:

TraySetClick(16)

^Error

Unknown function name.

Don't know if I'm mistaken or not but do hope you solve it out.

<{POST_SNAPBACK}>

You mean you are not using the TAY MENU THING ?? :lmao:

YOU NEED THE TRAY MENU THING TO MAKE THE SCRIPT WORK!!

CAN BE FOUND IN THE IDEAS FORUM!

<{POST_SNAPBACK}>

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

i fixed the playlist funtion now and it will play the playlist when the song is done.

i also added a pause resume button, but it's not fully working.

Delete stuff from playlist is also comming.

i'll give the new script when the bugs are out.

p.s. when its done it'll be able to FULLY replace mediaplayer :lmao: (i hope)

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

thats a note to all users who get this!

You mean you are not using the TAY MENU THING ?? :lmao:

zero, why don't you post the compiled version so people don't have to download the special autoit?

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

:lmao:<----ZeroPlayer

^------------Other players

that is, once its completely finished

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

I can't get it to work o:) I dl'ed the "traymenu thing" zip file and I used the .exe to open the mediaplayer scipt. I drag n drop a .mp3 to the control and it shows up. But it won't play. (Yes I've checked my volume :lmao: ) I must be doing something wrong. Do I need to put any of those .zip files in the autoit3 folder? If so which ones? Can someone explain what all those files are. I understand it creates a tray menu, but I don't know how to implement into my programs. Thanks

AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

i'll attach the last version of it.

its decompile able with no pass if i remeber correctly

Edited by zeroZshadow
*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

  • 7 months later...

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