Jump to content
Sign in to follow this  
TheRydad

Detect System Tray ToolTip Pop-up

Recommended Posts

TheRydad

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:
 
Screenshot%202014-03-11%2017.22.29.jpg
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 by TheRydad

Share this post


Link to post
Share on other sites
this-is-me

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 by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites
TheRydad

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...

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  

×