1

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

LastBye
  • 1,143
  • 4
  • 19
  • 37

2 Answers2

1

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.

wOxxOm
  • 65,848
  • 11
  • 132
  • 136
  • The application is written in Visual Studio, Is the class name of the tray icon side of it different from the original apps class name? If so how do you think I can find the class name of it or activate it? – LastBye Aug 13 '15 at 09:41
  • Thanks dude for the info, I'll try your answer, The first didn't work for me, I think should go for the second, will ask u if there were any related issue. – LastBye Aug 13 '15 at 11:06
0

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

kanlukasz
  • 1,103
  • 19
  • 34