Jump to content
Sign in to follow this  
Sobiech

A small button, how to

Recommended Posts

Sobiech

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

Share this post


Link to post
Share on other sites
bill88

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

Share this post


Link to post
Share on other sites
Sobiech

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.