pboom Posted October 14, 2019 Share Posted October 14, 2019 I am working on monitoring utility for a medical application. The AutoIt application needs to produce an audible alarm on a standard PC. Using a combination of Sound.au3 , _AudioEndpointVolume.au3 and SoundSetWaveVolume() I can set the volume level and play my alarm sound. However, the end-user can still Mute my specific application ZollLaunch. I haven't found a way to programmatically unmute it, see the image. This screenshot is from Windows 7 the same issue exists in Windows 10. Does anyone know of how to unmute a specific application in AutoIt without automating the GUI or using NirSoft's SoundVolumeView. I don't feel automating the GUI or running the Nirsoft utility will provide a robust enough solution. Between the following two posts Mute Microphone and _AudioEndPointVolume it would seem to be possible but above my skill level. The vendor-supplied utility doesn't do anything with volume controls making it far to easy for the end-user to mute the sound and all future alarms. Just one of the issues I am addressing by writing my own utility. Any help much appreciated. Link to comment Share on other sites More sharing options...
Werty Posted October 14, 2019 Share Posted October 14, 2019 Have you tried sending the keyboard function VOLUME_MUTE ? #include <AutoItConstants.au3> Send("{VOLUME_MUTE}") Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
pboom Posted October 18, 2019 Author Share Posted October 18, 2019 Thanks for the reply Werty. The keyboard function VOLUME_MUTE only works on the master mute, if the individual program mute is activated it will not unmute the channel. Also, Send("{VOLUME_MUTE}") toggles the mute state it does not leave it in a defined state. My application requires that the sound is playing with a great deal of certainty. Therefore, in addition, I was not comfortable using GUI interactions. Link to comment Share on other sites More sharing options...
Werty Posted October 18, 2019 Share Posted October 18, 2019 Ahh, sorry about that. As a work around until you get it solved you could make your script make BEEP......BEEP......BEEP.... sounds every 2-5 seconds, if the BEEP's stop something is wrong You said it's for medical monitoring and such places always have machines standing there making constant BEEP sounds, atleast it is so in movies and tv-series Though i would guess it could be rather annoying Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Inpho Posted October 18, 2019 Share Posted October 18, 2019 Works for me WinSetVolume("Google Chrome", 20) Link to comment Share on other sites More sharing options...
KaFu Posted October 18, 2019 Share Posted October 18, 2019 There's a great script by @Danyfirex here, enumerating through the apps playing sounds ("sessions"). Also there seems to be an interface called ISimpleAudioVolume with which you can get and set the sessions mute state. Sadly I couldn't get it to work, here's what I got so far for info. ; https://docs.microsoft.com/en-us/windows/win32/coreaudio/endpointvolume-api Local $pISimpleAudioVolume = 0 $oIAudioSessionManager2.GetSimpleAudioVolume($pIAudioSessionControl2, False, $pISimpleAudioVolume) ConsoleWrite("$pISimpleAudioVolume=" & $pISimpleAudioVolume & @CRLF) Global Const $sIID_ISimpleAudioVolume = "{87CE5498-68D6-44E5-9215-6DA47EF883D8}" Global Const $sTagISimpleAudioVolume = "GetMasterVolume hresult(float); GetMute hresult(ptr);SetMasterVolume hresult(float;ptr*);SetMute hresult(ptr;ptr*);" Local $oISimpleAudioVolume = 0 $oISimpleAudioVolume = ObjCreateInterface($pISimpleAudioVolume, $sIID_ISimpleAudioVolume, $sTagISimpleAudioVolume) ConsoleWrite("$oISimpleAudioVolume=" & IsObj($oISimpleAudioVolume) & @CRLF) Local $pbMute = 0 Local $iVolume = 0 ConsoleWrite("$oISimpleAudioVolume.GetMasterVolume=" & $oISimpleAudioVolume.GetMasterVolume($iVolume) & @CRLF) ConsoleWrite("$oISimpleAudioVolume.GetMute=" & $oISimpleAudioVolume.GetMute($pbMute) & @CRLF) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now