AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tray click and active window

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
RobOtter



Joined: 30 Jan 2005
Posts: 133
Location: Darmstadt, Germany

PostPosted: Wed Feb 25, 2009 9:26 am    Post subject: Tray click and active window Reply with quote

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 Sad
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
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Wed Feb 25, 2009 9:37 am    Post subject: Reply with quote

Quote:
So what I can do?


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
View user's profile Send private message Send e-mail
RobOtter



Joined: 30 Jan 2005
Posts: 133
Location: Darmstadt, Germany

PostPosted: Wed Feb 25, 2009 12:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group