quever Posted August 16, 2007 Share Posted August 16, 2007 I need to retrieve the title from the active window that has focus. This is not necessarily the top-most window (because I have some things that are always on top). This is the code from my latest attempt, where I realized that there can be many active windows (near 100 in my case) but only one of them will have focus. I am making a personal utility that needs to modify the window that has focus when I press a hotkey. I am designing it to work with any window. Therefore, I have no title, partial title, or text to search with. I would appreciate it if someone could point me in the right direction. Thanks in advance $winList = WinList() $found = 0 For $i = 1 to $winList[0][0] If WinActive($winList[$i][0]) Then $activeT =$winList[$i][0] $activeH =$winList[$i][1] $found=$i EndIf Next Link to comment Share on other sites More sharing options...
Developers Jos Posted August 16, 2007 Developers Share Posted August 16, 2007 WinGetTitle("") returns the active window's title. WinGetTitle works on both minimized and hidden windows. If multiple windows match the criteria, the most recently active window is used. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
weaponx Posted August 16, 2007 Share Posted August 16, 2007 Per the help file: WinGetTitle("") returns the active window's title. Link to comment Share on other sites More sharing options...
quever Posted August 16, 2007 Author Share Posted August 16, 2007 Thanks, I know i read about that function in the help file I just didn't read the remark. I remember thinking, "why would I need to wingettitle if I already had the title as a parameter". I guess i figured that the default string would return everything like winlist. You both have my thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now