0
votes

Imagine my application's window class name is classAbc

My app has a minimized in tray ability,

When a custom key is pressed it goes into tray,

How to activate it from the tray?

WinActivate,  ahk_class classAbc

won't work at that time

I also tried WinShow with no success

Will it have a different class name when it goes into tray?

if so I used a macro recorder to find it's class name when it is resident in tray

but just found 2 classes which I think both are related to Microsoft windows menubar itself:

The classes and the activation codes:

WinActivate,  ahk_class Shell_TrayWnd
WinActivate,  ahk_class NotifyIconOverflowWindow

Tried these also but my app doesn't appeared once it goes to the tray.

Thanks in advance for any help

2

2 Answers

1
votes

There are two methods depending on how your application manages its minimizing to tray:

  1. WinShow ahk_class YOUR_APP_WINDOW_CLASS - to get the main window class name use AHK's built-in Window Spy available from a tray menu of an AHK script or in Windows Start Menu.

  2. If the above method stops working on subsequent runs then the application stores its minimization state internally and you'll have to use TrayIcons function to send a mouse click message to the tray icon.

0
votes

Since the application that is in the tray is just hidden (usually), you should use DetectHiddenWindows first. Then you use WinActivate

So it will look like this

#NoEn           ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

DetectHiddenWindows, On
WinActivate, ahk_class classAbc

PS. I don't know what you want to do after activating the app from tray, but it might be a good idea to use WinWaitActive before anything else