Reputation: 2501
I tried to use
winget, title, ID
msgbox %title%
but the message box comes up blank. what am I missing here ?
Upvotes: 1
Views: 2834
Reputation: 6371
If you wanted the window on the bottom you could utilize winactivatebottom
but since you want the top one, you are going to have to loop through the windows, I think. This little snippet will give you the windows, and the index should be their order, I think.
Take a look at this snippet I fetched from here.
F2::
WinGet, WindowList, List
ToolTip
List =
Loop %WindowList%
{
WinUID := WindowList%A_Index%
WinGetTitle, WinTitle, ahk_id %WinUID%
List = %List%Window %A_Index% of %WindowList%`n%WinTitle%`n%WinUID%`n`n
}
ToolTip %List%
Return
However, if you don't need the topmost
window, but only the active
window, then you are in luck! Just use wingetactivetitle
(straight from a simple search through the documenation's index. The docs are your friends!)
WinGetActiveTitle, TheTitle
Upvotes: 3