KDoc Posted February 24, 2022 Posted February 24, 2022 Hi, Is there any way in Autoit to make a specific window active that is of a certain class AND has a specific title? The reason is that I have multiple instances of windows of the same class but different titles (captions) and I want a specific window to come to the front with a Autoit command. Thanks Kris
Nine Posted February 24, 2022 Posted February 24, 2022 See WinList using "Title Special Definition" class option. You will get an array of all the windows with a very specific class. Parse the array to find the exact title you are looking for. It will give you a unique handle that you could use to bring the window in front. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ad777 Posted February 24, 2022 Posted February 24, 2022 (edited) @KDoc WinActivate(_WinGetByTC("CalcFrame", "Calculator"));active window by title = Calculator & class=CalcFrame Func _WinGetByTC($class, $title) Local $WIN = WinList("[CLASS:" & $class & "]") For $i = 0 To UBound($WIN) If $WIN[$i][1] <> "" Then If $title = WinGetTitle($WIN[$i][1]) Then Return $WIN[$i][1] EndIf EndIf Next EndFunc ;==>_WinGetByTC Edited February 24, 2022 by ad777 none
Nine Posted February 24, 2022 Posted February 24, 2022 Not quite. WinList returns a 1-based array. And there is no need to retrieve the title again since WinList already give it. Streamlined : WinActivate(_WinGetByTC("CalcFrame", "Calculator"));active window by title = Calculator & class=CalcFrame Func _WinGetByTC($class, $title) Local $WIN = WinList("[CLASS:" & $class & "]") For $i = 1 To $WIN[0][0] If $WIN[$i][0] = $title Then Return $WIN[$i][1] Next EndFunc ;==>_WinGetByTC “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
dogisay Posted January 10, 2023 Posted January 10, 2023 Just? WinActivate("[TITLE:Calculator; CLASS:CalcFrame]")
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