Hi Owen,
Thanks for adding that script, I appreciate it! I got it working. FYI, the description says to modify line 17, not 11.
I was actually after it functioning on recording devices, not playback, but fortunately my device has a playback and recording function so if it's unplugged both functionalities disappear so I can make do with it just doing playback, but if it's easy to add recording monitoring that'd be great.
Since sending the first message I've been able to put together a Powershell script that fires off an email when it's launched. I was able to moify the code a bit and changed line 46 to be
BFS.Application.Start("C:/Users/GCC-Server/Documents/Scripts/Audio_devices_disconnected_email_alert.bat");
The bat file then runs a Powershell script.
So I'm really close to having this working. So stoked!
However I'm running into a few problems. If I set it to trigger the function every few minutes, then the functions keep running and I get more and more of the same functions all running at once.
Is it possible to kill the function off after a period of time or to only have 1 instance of the function running at once?
Ideally I'd want it to check every few minutes for the audio device, and if it's there then just keep monitoring it. If it's not there then trigger the .bat file, and then go back to monitoring. Obviously if the audio device isn't restored promptly I'd get heaps of emails, so somehow limiting it to only trigger the .bat file once a day would be great. Or another potentially simpler option would be that if there is no audio device, open the .bat file and stop the function. I could then set the trigger to run the function once a day, whilst somehow only ever having one instance of the function running at any given time.