Activating an application from the tray in Windows 10

Get help with using AutoHotkey and its commands and hotkeys
Posts: 20
Joined: 10 Dec 2016, 14:09

Activating an application from the tray in Windows 10

15 May 2018, 20:37

I'm running AutoHotKey v1.1.28.0 on Windows 10 /64.

This post from a few year ago shows an example of exactly what I want to do:
Open the window of an application that is running, but minimized to the Tray.

I copied in the text for the TrayIcons function into my autohotkey.ahk and adjusted the hotkey function like this:

Code: Select all

 DetectHiddenWindows, On
 TI := TrayIcons( "greenshot.exe" )
 StringSplit,TIV, TI, |
 MsgBox, 0, TI, % TI, 1 
 uID  := RegExReplace( TIV4, "uID: " )
 Msg  := RegExReplace( TIV5, "MessageID: " )
 hWnd := RegExReplace( TIV6, "hWnd: " )
 PostMessage, Msg, uID,0x0203,, ahk_id %hWnd% ; Double Click Greenshot Icon
 DetectHiddenWindows, Off

Unfortunately it does nothing. I added the MsgBox function to help debug. It displays the string returned from TrayIcons(), which seems to be an empty string.
I realize the TrayIcons() code is old, but is there any way to fix it so it can work with Windows 10?
Posts: 299
Joined: 26 Apr 2014, 07:57

Re: Activating an application from the tray in Windows 10

16 May 2018, 01:51

Yes you can fix it. There is another thread somewhere around here (sorry I completely forget what its title was, but it's on this site), which may be of help, if needed.

The crux of the problem is to do with getting the tray itself. Windows 10 uses different control names to what windows 7 did, and hence it cant find the icon area of the tray, since it's looking for the wrong controls, you need to update their names to the required values, which you will be able to see by using ahk's Window Spy. (You'll be looking for controlget's in the existing code to update).

To be honest you should also have a look for an updated version first as I know the version you're using was updated quite some time ago (by Sean ? I think) but even the updated version still had the above problem.

Return to “Ask For Help”

Who is online

Users browsing this forum: Frosti, Google [Bot], jvalk87, seba1685, TAC109 and 34 guests