AutoIt SoundPlay

How to use the AutoIt SoundPlay Function to play sound files.

The AutoIt SoundPlay function can be used to play sound files on a computer. The files that will be played by the function depends on the codecs installed, so it should also be possible to play .mp3 and .mid files, as well as the standard .wav format.

Parameters

filenameThe exact file path.
waitTakes a value of 1/0, determines if the script should wait exiting until the file has played, the alternative is to sleep for the duration of the sound file.

AutoIt SoundPlay Example

The below example will play the "tada.wav" located inside the windows directory, and wait exiting until the script has finished playing the file.

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