TheRydad Posted March 11, 2014 Share Posted March 11, 2014 (edited) I am writing a script that will detect when headphones are plugged into/unplugged from my laptop so that I can mute/unmute the master volume when these events occur. The audio driver provides a tooltip notification in the system tray when a plug/unplug event occurs. Maddeningly, it does not provide a mechanism to mute/unmute based on this event. I have used Window Info to get the class and title of the popup tooltip. However, when I try to use this information in WinExists or WinWaitActive, the window is never found. I have written a test script using WinList to enumerate all windows and that tooltip never appears in the active window list. Here is the script I am trying to run for now on my Windows 8 laptop. The message box never fires. The other threads I have found regarding this issue make it seem like this should be pretty straightforward. Anyone have any pointers or advice? $windowtitle = "[TITLE:You just plugged a device into the audio jack.;CLASS:tooltips_class32]" $windowtext = "" Do If WinExists($windowtitle, $windowtext) Then MsgBox(0,"Unplugged","The headphones were unplugged.") EndIf Until 0 = 1 And here is the Window Info: Edit: The image is hosted on my Dropbox and doesn't appear to work inline, but you should be able to open it in a new window/tab. Sorry. Edited March 11, 2014 by TheRydad Link to comment Share on other sites More sharing options...
this-is-me Posted March 11, 2014 Share Posted March 11, 2014 (edited) Try Opt("WinSearchChildren", 1) and see if it makes a difference. Also, add a sleep in your do loop so your cpu won't be overloaded. Edit:spelling Edited March 11, 2014 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
TheRydad Posted March 12, 2014 Author Share Posted March 12, 2014 Thanks. I thought I remembered a setting like that, but couldn't remember what it was. Unfortunately, it didn't work in this instance. I'll keep trying, though... 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