| View previous topic :: View next topic |
| Author |
Message |
RobOtter
Joined: 30 Jan 2005 Posts: 133 Location: Darmstadt, Germany
|
Posted: Wed Feb 25, 2009 9:26 am Post subject: Tray click and active window |
|
|
Hi there,
how can I get the window that had the focus when I click the tray icon of my script? The window loses the focus when I tray-click
As far as I understand, I cannot use WinWait or something similar to WinActivate the last found window because my app can work on any window (so, what window should I wait for?).
At the moment, I reactivate the last window by
| Code: | | Send {Alt Down}{Tab}{Alt Up} |
which is not very elegant because the task changing window shortly flares up.
From the german forum I got the hint to use WinList:
| Code: | WinGet, Liste, List
MsgBox, %Liste%: %Liste1% - %Liste2% - %Liste3% - %Liste4% - %Liste5% |
Unlike stated in the help file, the list is not ordered with the recently active window as the first element. Instead (at least in my multi-monitor environment), the order of windows in the list array stays the same no matter in which sequence I had activated them or place them one over the other. Additionally I was told that there might be problems with AOT windows.
So what I can do? |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Wed Feb 25, 2009 9:37 am Post subject: |
|
|
Try Experiment 2 in How to Hook on to Shell to receive its messages?
| Quote: | At the moment, I reactivate the last window by
| Code: | | Send {Alt Down}{Tab}{Alt Up} |
which is not very elegant because the task changing window shortly flares up. |
You could use Send !{Esc}, I guess. |
|
| Back to top |
|
 |
RobOtter
Joined: 30 Jan 2005 Posts: 133 Location: Darmstadt, Germany
|
Posted: Wed Feb 25, 2009 12:15 pm Post subject: |
|
|
Thanks SKAN, that has helped!
I´ve read the thread that is linked in your thread and am prepared that I might get some other problems in the future when releasing my app to the public...
For my current simple testings, the !{Esc} solution did the trick (I was not aware of this hotkey before) but I prefer to use the hooking solution which seems to have less side effects.
Thanks,
Rob |
|
| Back to top |
|
 |
|