Jump to content

A small button, how to


Recommended Posts

Hi

I want create button with function to browse mp3 file and play when the script end >_<

hmmm

Something like program where we set our mp3, click start and wait 3 seconds for our song.

Next problem is i dont want select file every time, just one select on future.

Is this possible?

Thx for all who help or try help with this :(

This world is crazy

Link to comment
Share on other sites

Hi

I want create button with function to browse mp3 file and play when the script end >_<

hmmm

Something like program where we set our mp3, click start and wait 3 seconds for our song.

Next problem is i dont want select file every time, just one select on future.

Is this possible?

Thx for all who help or try help with this :(

Global $Button1
Global $Settings = @ScriptDir & "\Settings.ini"

GUICreate("Title",100,100)
$Button1=GUICtrlCreateButton("Click Me",30,50)
GUISetState()


While (1)
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    If $msg = $Button1 Then PlayMp3()
WEnd
    
Func PlayMp3()
    If FileExists($Settings) Then
        $Read = IniRead($Settings,"Section","LastMp3","")
            If Not ($Read = "") Then
                Sleep(3000)
                SoundPlay($Read)
            Else
                SelectMp3()
            EndIf
    Else
        SelectMp3()
    EndIf
EndFunc

Func SelectMp3()
    $Location = FileOpenDialog("Title",@ScriptDir,"MP3 (*.mp3)")
        If Not ($Location = "") Then
            IniWrite($Settings,"Section","LastMp3",$Location)
            Sleep(3000)
            SoundPlay($Location)
        Else
            SelectMp3()
        EndIf
EndFunc
Link to comment
Share on other sites

Global $Button1
Global $Settings = @ScriptDir & "\Settings.ini"

GUICreate("Title",100,100)
$Button1=GUICtrlCreateButton("Click Me",30,50)
GUISetState()


While (1)
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    If $msg = $Button1 Then PlayMp3()
WEnd
    
Func PlayMp3()
    If FileExists($Settings) Then
        $Read = IniRead($Settings,"Section","LastMp3","")
            If Not ($Read = "") Then
                Sleep(3000)
                SoundPlay($Read)
            Else
                SelectMp3()
            EndIf
    Else
        SelectMp3()
    EndIf
EndFunc

Func SelectMp3()
    $Location = FileOpenDialog("Title",@ScriptDir,"MP3 (*.mp3)")
        If Not ($Location = "") Then
            IniWrite($Settings,"Section","LastMp3",$Location)
            Sleep(3000)
            SoundPlay($Location)
        Else
            SelectMp3()
        EndIf
EndFunc

THX men i think this is enought >_<

in Polish language

Dzięki koleś jesteś zajebisty :(

This world is crazy

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