Jump to content
Sign in to follow this  

Simple Music Player

Recommended Posts


#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Building Something Out of Nothing", 654, 566, 302, 218)
    $n1 = GUICtrlCreateList("", 64, 170, 521, 385)
    GUICtrlSetData(-1, "Grey Ice Water|Interstate 8|", "")

    $n2 = GUICtrlCreateButton("Play", 10, 110, 50)
    GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button


$Pic1 = GUICtrlCreatePic(@ScriptDir & "\BNOS.jpg", 200, 24, 233, 145, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    If $nMsg = $n2 Then
            If GUICtrlRead($n1) = "Grey Ice Water" Then SoundPlay(@ScriptDir & "\Album\Modest Mouse- Grey Ice Water.mp3",1) &
            If GUICtrlRead($n1) = "Interstate 8" Then SoundPlay(@ScriptDir & "\Album\Modest Mouse - Interstate 8.mp3", 1)
    Switch $nMsg
        Case $GUI_EVENT_CLOSE


Right now, the songs will play perfectly, but after you click the play button, the entire program freezes, and you can't click on anything else. Does anyone have a solution to unfreeze the program and perhaps add in a pause button for the song?



Share this post

Link to post
Share on other sites

Are you serious? You specifically wrote your script to wait until playback is done!



Play a sound file.

SoundPlay ( "filename" [, wait] )

wait [optional] This flag determines if the script should wait for the sound to finish before continuing:

1 = wait until sound has finished

0 = continue script while sound is playing (default)

As for pausing etc, look at _PlaySound() and it's relatives under "Sound Management" in the helpfile.

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.