Question

Hi I'm looking for some guidance on a AHK script. I am trying to activate a window that is hidden in the notification tray.

I can simply use the applications name

WinShow Wunderlist

or use the value from the win spy

WinShow ahk_class HwndWrapper[Wunderlist.exe;;39ed0161-133a-4763-b2f7-083745b1d664]

Both result in the same thing, the window flashes up then is hidden, and I can just see a single pixel outline of the window.

Clicking the icon then the application on the task bar will then bring it to the front.

I"m not sure if I"m just doing something wrong or if it is something bizarre with that App. I believe it is a WPF app as it uses the HwndWrapper class

Was it helpful?

Solution

WinShow is critical, since it will only only be able to successfully show a window that is already completely painted, and simply has a certain window style. Unfortunately, you never know what applications do when they hide a window (e.g. destroying the window or parts of it). It seems that clicking the tray icon will do more than just change the window style; apparently, the window gets repainted or something similar.
Clicking a tray icon with AHK isn't trivial either, and comes with several pitfalls.
Often, the best option is starting the program again. Usually, running the application's exe will do the trick. This is due to most applications only allowing one instance to run simultaneously. Instead of running another instance, they bring the main window to the foreground.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top