Jump to content

Recommended Posts

Posted

ok u might know im making a media player...

I had it all working but then i broke it...

Also i want the time to show in proper time not 2.54647 and all that crap do anybody know how to fix it...

here is my code

#include <GUIConstants.au3>
#include <Sound.au3>
$sound = "NONE"

SoundSetWaveVolume(100)
#Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\mplayer\gui.kxf
$AForm1 = GUICreate("Ashley's MediaPlayer", 633, 447, 193, 115)
$AGroup1 = GUICtrlCreateGroup("", 136, 384, 369, 57)
$Play = GUICtrlCreateButton("Play", 144, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Stop = GUICtrlCreateButton("Stop", 360, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Open = GUICtrlCreateButton("open", 424, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Pause = GUICtrlCreateButton("Pause", 208, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Made = GUICtrlCreateLabel("Made by Ashley", 272, 400, 79, 17)
$loop = GUICtrlCreateCheckbox("loop", 288, 416, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 8, 336, 65, 17)
$edit = GUICtrlCreateInput("NONE", 72, 336, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("Duration:", 536, 384, 47, 17, BitOR($SS_CENTERIMAGE,$WS_BORDER,$WS_CLIPSIBLINGS))
$ALabel1 = GUICtrlCreateLabel("This is a pre release...", 160, 64, 318, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$ALabel2 = GUICtrlCreateLabel("Some Functions do not work...", 110, 159, 439, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Slider = GUICtrlCreateSlider(40, 360, 542, 21, BitOR($TBS_BOTH,$TBS_NOTICKS,$WS_BORDER,$WS_CLIPSIBLINGS))
$Starttime = GUICtrlCreateLabel("", 0, 360, 36, 17)
$Rtime = GUICtrlCreateLabel("", 584, 360, 36, 17)
GUISetState(@SW_SHOW)
Local $s, $SL
#EndRegion ### END Koda GUI section ###

AdlibEnable("SliderProgress")
AdlibEnable("StartProgress")
AdlibEnable("TimeProgress")

While 1
    $msg = GUIGetMsg()

  Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        
        Case $msg = $stop
            GUICtrlSetData($Duration, "Stopping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stopped")
            
        Case $msg = $open
            GUICtrlSetData($Duration, "Open")
            $sound=FileOpenDialog("Open Music File","C:\Documents and Settings\Windows\My Documents\My Music","Music Files(*.mp3;*.wav;*.wma;*.cda)",3)
            $s = _SoundOpen($sound)
            $SL = _SoundLength($s, 2)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
            
            
        Case $msg = $play
            If GUICtrlRead($Duration) = "Stopped" Or GUICtrlRead($Duration) = "" Then
                GUICtrlSetData($Duration, "Playing")
            ElseIf GUICtrlRead($Duration) = "Paused" Then
                GUICtrlSetData($Duration, "Playing")
            EndIf
            _SoundPlay($s)

;pause                
        Case $msg = $Pause  
            If GUICtrlRead($Duration) = "Playing" Then
                Sleep(100)
                GUICtrlSetData($Duration, "Pausing") 
                Sleep(300)              
                _SoundPause($s)
                Sleep(100)
                GUICtrlSetData($Duration, "Paused")    
            EndIf
        
endselect
WEnd

Func StartProgress()
    GUICtrlSetData($Starttime,_SoundLength($s, 2));change the time for song
EndFunc

Func SliderProgress()
    GUICtrlSetData($Slider,_SoundPos($s, 2)/ $SL * 100);move the slider as the song progresses
EndFunc

Func TimeProgress()
    GUICtrlSetData($Rtime,_SoundPos($s, 2)/ $SL * 100);change the time left
EndFunc

please help

Posted

; ...

Also i want the time to show in proper time not 2.54647 and all that crap do anybody know how to fix it...

here is my code

Func StartProgress()
    GUICtrlSetData($Starttime,_SoundLength($s, 2));change the time for song
EndFunc

Func SliderProgress()
    GUICtrlSetData($Slider,_SoundPos($s, 2)/ $SL * 100);move the slider as the song progresses
EndFunc

Func TimeProgress()
    GUICtrlSetData($Rtime,_SoundPos($s, 2)/ $SL * 100);change the time left
EndFuncoÝ÷ Ûú®¢×¥u·j̲¢æ«zë"
)¶*'Û­*.Óè³Mú³k(¶§ºfÞ®+&X¬yÊ'vÄájÝý²
(uú+ʬ'^­»­_¢ºkzǧ¶)ඬz»    ºËn±ê)¶*'ÖÚ zÖ¡ºf§­æi¹^²Úâ®¶­sdgVæ27F'E&öw&W72¢uT7G&Å6WDFFb33cµ7F'GFÖRÂõ6÷VæDÆVæwFb33c·2¶6ævRFRFÖRf÷"6öæp¤VæDgVæ0

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

thanks but that dont do anything since the slider and lenth lable dont work

slider dont more lable dont show...

can u help heres what i have

#include <GUIConstants.au3>
#include <Sound.au3>
$sound = "NONE"

SoundSetWaveVolume(100)
#Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\mplayer\gui.kxf
$AForm1 = GUICreate("Ashley's MediaPlayer", 633, 447, 193, 115)
$AGroup1 = GUICtrlCreateGroup("", 136, 384, 369, 57)
$Play = GUICtrlCreateButton("Play", 144, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Stop = GUICtrlCreateButton("Stop", 360, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Open = GUICtrlCreateButton("open", 424, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Pause = GUICtrlCreateButton("Pause", 208, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Made = GUICtrlCreateLabel("Made by Ashley", 272, 400, 79, 17)
$loop = GUICtrlCreateCheckbox("loop", 288, 416, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 8, 336, 65, 17)
$edit = GUICtrlCreateInput("NONE", 72, 336, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("Duration:", 536, 384, 47, 17, BitOR($SS_CENTERIMAGE,$WS_BORDER,$WS_CLIPSIBLINGS))
$ALabel1 = GUICtrlCreateLabel("This is a pre release...", 160, 64, 318, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$ALabel2 = GUICtrlCreateLabel("Some Functions do not work...", 110, 159, 439, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Slider = GUICtrlCreateSlider(40, 360, 542, 21, BitOR($TBS_BOTH,$TBS_NOTICKS,$WS_BORDER,$WS_CLIPSIBLINGS))
$Starttime = GUICtrlCreateLabel("", 0, 360, 36, 17)
$Rtime = GUICtrlCreateLabel("", 584, 360, 36, 17)
GUISetState(@SW_SHOW)
Local $s, $SL
#EndRegion ### END Koda GUI section ###

AdlibEnable("SliderProgress")
AdlibEnable("StartProgress")
AdlibEnable("TimeProgress")

While 1
    $msg = GUIGetMsg()

  Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        
        Case $msg = $stop
            GUICtrlSetData($Duration, "Stopping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stopped")
            
        Case $msg = $open
            GUICtrlSetData($Duration, "Open")
            $sound=FileOpenDialog("Open Music File","C:\Documents and Settings\Windows\My Documents\My Music","Music Files(*.mp3;*.wav;*.wma;*.cda)",3)
            $s = _SoundOpen($sound)
            $SL = _SoundLength($s, 2)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
            
            
        Case $msg = $play
            If GUICtrlRead($Duration) = "Stopped" Or GUICtrlRead($Duration) = "" Then
                GUICtrlSetData($Duration, "Playing")
            ElseIf GUICtrlRead($Duration) = "Paused" Then
                GUICtrlSetData($Duration, "Playing")
            EndIf
            _SoundPlay($s)

;pause                
        Case $msg = $Pause  
            If GUICtrlRead($Duration) = "Playing" Then
                Sleep(100)
                GUICtrlSetData($Duration, "Pausing") 
                Sleep(300)              
                _SoundPause($s)
                Sleep(100)
                GUICtrlSetData($Duration, "Paused")    
            EndIf
        
endselect
WEnd

Func StartProgress()
    GUICtrlSetData($Starttime, _SoundLength($s, 1));change the time for song
EndFunc

Func SliderProgress()
    GUICtrlSetData($Slider,_SoundPos($s, 2)/ $SL * 100);move the slider as the song progresses
EndFunc

Func TimeProgress()
    GUICtrlSetData($Rtime,_SoundPos($s, 2)/ $SL * 100);change the time left
EndFunc
Posted (edited)

thanks but that dont do anything since the slider and lenth lable dont work

slider dont more lable dont show...

can u help heres what i have

I don't have time to work out all the issues right now, but this is the big problem: You can only have one AdLibEnable() at a time, you are trying to use three. In addition, your controls are only 36 pixels wide, so you can't read them anyway. This is at least closer:

#include <GUIConstants.au3>
#include <Sound.au3>
$sound = "NONE"

SoundSetWaveVolume(100)
#Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\mplayer\gui.kxf
$AForm1 = GUICreate("Ashley's MediaPlayer", 633, 447, 193, 115)
$AGroup1 = GUICtrlCreateGroup("", 136, 384, 369, 57)
$Play = GUICtrlCreateButton("Play", 144, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Stop = GUICtrlCreateButton("Stop", 360, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Open = GUICtrlCreateButton("open", 424, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Pause = GUICtrlCreateButton("Pause", 208, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Made = GUICtrlCreateLabel("Made by Ashley", 272, 400, 79, 17)
$loop = GUICtrlCreateCheckbox("loop", 288, 416, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 8, 336, 65, 17)
$edit = GUICtrlCreateInput("NONE", 72, 336, 113, 21, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Duration = GUICtrlCreateLabel("Duration:", 536, 384, 47, 17, BitOR($SS_CENTERIMAGE, $WS_BORDER, $WS_CLIPSIBLINGS))
$ALabel1 = GUICtrlCreateLabel("This is a pre release...", 160, 64, 318, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$ALabel2 = GUICtrlCreateLabel("Some Functions do not work...", 110, 159, 439, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Slider = GUICtrlCreateSlider(40, 360, 542, 21, BitOR($TBS_BOTH, $TBS_NOTICKS, $WS_BORDER, $WS_CLIPSIBLINGS))
$Starttime = GUICtrlCreateLabel("<StartTime>", 10, 290, 100, 17)
$Rtime = GUICtrlCreateLabel("<RTime>", 500, 290, 100, 17)
GUISetState(@SW_SHOW)
Local $s, $SL
#EndRegion ### END Koda GUI section ###

AdlibEnable("UpdateProgress")

While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Stop
            GUICtrlSetData($Duration, "Stopping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stopped")

        Case $msg = $Open
            GUICtrlSetData($Duration, "Open")
            $sound = FileOpenDialog("Open Music File", "C:\Documents and Settings\Windows\My Documents\My Music", "Music Files(*.mp3;*.wav;*.wma;*.cda)", 3)
            $s = _SoundOpen($sound)
            $SL = _SoundLength($s, 2)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)


        Case $msg = $Play
            If GUICtrlRead($Duration) = "Stopped" Or GUICtrlRead($Duration) = "" Then
                GUICtrlSetData($Duration, "Playing")
            ElseIf GUICtrlRead($Duration) = "Paused" Then
                GUICtrlSetData($Duration, "Playing")
            EndIf
            _SoundPlay($s)

            ;pause
        Case $msg = $Pause
            If GUICtrlRead($Duration) = "Playing" Then
                Sleep(100)
                GUICtrlSetData($Duration, "Pausing")
                Sleep(300)
                _SoundPause($s)
                Sleep(100)
                GUICtrlSetData($Duration, "Paused")
            EndIf

    EndSelect
WEnd

Func UpdateProgress()
    GUICtrlSetData($Starttime, _SoundLength($s, 1));change the time for song
    GUICtrlSetData($Slider, _SoundPos($s, 2) / $SL * 100);move the slider as the song progresses
    GUICtrlSetData($Rtime, _SoundPos($s, 2) / $SL * 100);change the time left
EndFunc   ;==>UpdateProgress

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

I don't have time to work out all the issues right now, but this is the big problem: You can only have one AdLibEnable() at a time, you are trying to use three. In addition, your controls are only 36 pixels wide, so you can't read them anyway. This is at least closer:

#include <GUIConstants.au3>
#include <Sound.au3>
$sound = "NONE"

SoundSetWaveVolume(100)
#Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\mplayer\gui.kxf
$AForm1 = GUICreate("Ashley's MediaPlayer", 633, 447, 193, 115)
$AGroup1 = GUICtrlCreateGroup("", 136, 384, 369, 57)
$Play = GUICtrlCreateButton("Play", 144, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Stop = GUICtrlCreateButton("Stop", 360, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Open = GUICtrlCreateButton("open", 424, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Pause = GUICtrlCreateButton("Pause", 208, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Made = GUICtrlCreateLabel("Made by Ashley", 272, 400, 79, 17)
$loop = GUICtrlCreateCheckbox("loop", 288, 416, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 8, 336, 65, 17)
$edit = GUICtrlCreateInput("NONE", 72, 336, 113, 21, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Duration = GUICtrlCreateLabel("Duration:", 536, 384, 47, 17, BitOR($SS_CENTERIMAGE, $WS_BORDER, $WS_CLIPSIBLINGS))
$ALabel1 = GUICtrlCreateLabel("This is a pre release...", 160, 64, 318, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$ALabel2 = GUICtrlCreateLabel("Some Functions do not work...", 110, 159, 439, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Slider = GUICtrlCreateSlider(40, 360, 542, 21, BitOR($TBS_BOTH, $TBS_NOTICKS, $WS_BORDER, $WS_CLIPSIBLINGS))
$Starttime = GUICtrlCreateLabel("<StartTime>", 10, 290, 100, 17)
$Rtime = GUICtrlCreateLabel("<RTime>", 500, 290, 100, 17)
GUISetState(@SW_SHOW)
Local $s, $SL
#EndRegion ### END Koda GUI section ###

AdlibEnable("UpdateProgress")

While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Stop
            GUICtrlSetData($Duration, "Stopping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stopped")

        Case $msg = $Open
            GUICtrlSetData($Duration, "Open")
            $sound = FileOpenDialog("Open Music File", "C:\Documents and Settings\Windows\My Documents\My Music", "Music Files(*.mp3;*.wav;*.wma;*.cda)", 3)
            $s = _SoundOpen($sound)
            $SL = _SoundLength($s, 2)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
        Case $msg = $Play
            If GUICtrlRead($Duration) = "Stopped" Or GUICtrlRead($Duration) = "" Then
                GUICtrlSetData($Duration, "Playing")
            ElseIf GUICtrlRead($Duration) = "Paused" Then
                GUICtrlSetData($Duration, "Playing")
            EndIf
            _SoundPlay($s)

            ;pause
        Case $msg = $Pause
            If GUICtrlRead($Duration) = "Playing" Then
                Sleep(100)
                GUICtrlSetData($Duration, "Pausing")
                Sleep(300)
                _SoundPause($s)
                Sleep(100)
                GUICtrlSetData($Duration, "Paused")
            EndIf

    EndSelect
WEnd

Func UpdateProgress()
    GUICtrlSetData($Starttime, _SoundLength($s, 1));change the time for song
    GUICtrlSetData($Slider, _SoundPos($s, 2) / $SL * 100);move the slider as the song progresses
    GUICtrlSetData($Rtime, _SoundPos($s, 2) / $SL * 100);change the time left
EndFunc   ;==>UpdateProgress

:)

thanks

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
×
×
  • Create New...