Jump to content

win 8 -- play sound from active window only


smbs
 Share

Recommended Posts

I want to hear sound only from active window. If I have additional windows in background playing music I want them to be muted or sound set  close to zero % so I do not hear them when playing active window. On changing active window I want the previous active window to be muted--I dont mind having to click on newly activated window in order to restore sound.

Any ideas??

Thanx

Link to comment
Share on other sites

  • Moderators

Hi, smbs, welcome to the forum. First off, you need to be a little more specific. Are you trying to play a sound when a window is active, or do you mean you have multiple media player windows open and want to switch between them? If you would just like to play a sound from an active window, look at WinWaitActive in the help file. You should be able to do something like this:

WinWaitActive("[CLASS:Notepad]", "")
    ShellExecute(@WindowsDir & "\Media\Notify.wav")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

smbs, we were all "green" at one time. This forum is dedicated to helping people learn to use AutoIt; we follow more of a "teach a man to fish" motto, rather than just writing code for you. Our intent is not to be difficult, but to help you learn the language rather than having someone spoon-feed code to you as often happens on other language forums. I would suggest following the steps below, including a lot of reading in the help file.

1. Use the AutoIt Window Info tool (in the same directory where you installed AutoIt) on the media player, and capture the ID of the mute/pause button.

 

2. Read through the Control commands in the helpfile (ControlClick especially) to see what actions are available to you to click on the button.

 

3. Once you have something, even if it is not working as you would like it to, post back here and we can try to help further.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Sorry, I missed your reference to VLC. There have been a couple threads about automating QT apps; I see suggestions to check out the thread below. Not sure if it has any concrete examples, however.

 

'?do=embed' frameborder='0' data-embedContent>>

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...