Jump to content
Sign in to follow this  

Check if SoundPlay is running/active

Recommended Posts

Like title, i'm searching into the forum but i don't have find anything, so i'm posting a new thread

Example script:


If SoundPlay_isActive() Then
 MsgBox(0,0,"Song is running")
 MsgBox(0,0,"Song isn't running")

Func SoundPlay_isActive()
 ;put a function here

There is a way to recognize if SoundPlay is active or not?

Thanks ;)

Share this post

Link to post
Share on other sites

If you use _SoundOpen and _SoundPlay to play the file, you can then use _SoundStatus to tell you if it's still playing.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post

Link to post
Share on other sites

Oh, we have two different SoundPlay?

SoundPlay and _SoundPlay...

Anyway you have right, again ;)

#include <Sound.au3>

Local $aSound = _SoundOpen("2_minute_song.mp3")
If _SoundStatus($aSound) = "playing" Then
MsgBox(0,0,"Not running")

Thanks :D

Edited by johnmcloud

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By MightyMalcolm
      Hello everyone,
      I am not 100% sure how to phrase my problem so I'm sorry if the issue has been addressed elsewhere. Here is my situation: I have added a file called MyStartup.exe (generated by AutoIt) to the list of programmes to launch on startup via the Windows registry on my laptop. As soon as it is running, this file will display a 3 minutes (tooltip) countdown and in the end call Run("Another.exe"). The latter is an AutoIt script, too. Among other things, it contains a few SoundPlay() commands, but for some reason, there is no sound coming at all! Strangely, however, when i manually run the MyStartup.exe and let it do its job, THEN the Another.exe plays sounds properly.
      I can only guess what might be the matter here, since the same procedure (autostart) works fine on my other PC.
      Any help would be greatly appreciated
    • By rm65453
      I have a script that alerts every 1 hour with a wav file. It was working for a week and now this week it has stopped working.
      here is the sound loop code
      Send ("{VOLUME_UP}") _SetMasterVolumeLevel(0) Local $aSound = _SoundOpen("path\deliveryalert.wav") SoundPlay($aSound, 1) _SoundClose($aSound) $DeliveryFlag = 1  
      I have confirmed that the loop still runs at the designated time, just the file does not play.
    • By Danyfirex
      A Friend told me about this. so I got interesting in.
      ¿Did you know I was able to play sound directly from link using soundplay?
      SoundPlay("http://www.freesfx.co.uk/rx2/mp3s/10/12598_1439008511.mp3",1) should help file talks about it? I work for me a least wit mp3 hot link. with wav it doesn't.
    • By TheAutomator
      Hello programmers 
      it's been awhile since my last topic but I stumbled on something strange..
      make an Autoitscript and put this in it:
      soundplay("file.wav",1) then make a bunch of folders inside of other folders and put the script with the wav file into the deepest folder:
      new folder000new folder001new folder002new folder003new folder003new folder005new folder006new folder007new folder008new folder009new folder010my_autoitscript.au3 file.wav
      then try to play the sound file with your autoitscript...
      the sound does not play but if i place the script with the sound file a few folders up, it works.
      hope you can help me and thanks for reading my post,
  • Create New...