Jump to content
Sign in to follow this  
Harusal

Play a .mp3?

Recommended Posts

Harusal

I am trying to make so when the user clicks a button a .mp3 is played? how would i play a .mp3? any help is greatly appreciated

Share this post


Link to post
Share on other sites
Jono

I think this is the Script you want :) Its the best I could find on AutoIt help.

SoundPlay(@WindowsDir & "\media\tada.wav",1)
Edited by Jono

Share this post


Link to post
Share on other sites
Xav

this is when your files is in the same folder of the script. "the mp3 playing is «Tada.wav»

i guess with u jono .

$SoundFile = @SCRIPTDIR & '\tada.wav'
SoundPlay ( $SoundFile )

Share this post


Link to post
Share on other sites
BrettF
LeHuynhNam

i think it's useful for u!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Sound_clk = @TempDir & "\Sound_clk.wav"
FileInstall("C:\Sound_clk.wav", $Sound_clk)

$Form1 = GUICreate("Form1", 267, 165, 324, 300)
$Button1 = GUICtrlCreateButton("Button1", 96, 64, 65, 33, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
                                Case $Button1
                                        SoundPlay($Sound_clk)
                                      MsgBox(64,"Test","Test text")

    EndSwitch
WEnd

I'm Learner Of English so my words can have many mistake! I'll try my best to improve it

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.