Sign in to follow this  
Followers 0
quever

How do I retrieve the active window�s title?

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

:)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Per the help file:

WinGetTitle("") returns the active window's title.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0