By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Play a Sound File Using AutoIt

How to easily play a sound file such as .mp3, .wav, or .mid with AutoIt

Edited: 2012-07-05 01:27

This is just a quick reminder on how to play sound files with AutoIt. The AutoIt SoundPlay function will be used in this article.

Note. Playing certain files may require that you install the required cookies on your computer first.

It can sometimes be useful to play a sound, often to alert the system administrator to a script has encountered an error, has finished running, or some other situation. To do this, use the below code.


The above example assumes that MyFile.wav is located in the same directory as your script. It should also be possible to play other files, such as .mp3 files, given that the required cookies are installed on the system.

The last parameter: 1, indicates that the script should not exit, before the file stops playing.