Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Partial Title Match on Child Window Activate Function

$
0
0
Hello, new to AutoIt.   As far as I can tell, there is no direct way to activate a child window.  

The following function will correctly activate the child window, however, the child window text needs to be an exact match.

WinTitleMatchMode does not seem to apply or help in this case.

Thanks for any help!

#include <WinAPI.au3>
Func ChildActivate($appTitle, $formName)
AutoItSetOption("WinTitleMatchMode", 2)
$hWnd = WinGetHandle($appTitle, $formName)
$array = WinList($appTitle)
WinActive($hWnd)
$winarray = _WinAPI_EnumWindows(True, $hWnd)
For $i = 1 to $winarray[0][0]
	 $title = _WinAPI_GetWindowText($winarray[$i][0])
	 If ($title == $formName) or ($title == $formName & " *") Then
		 _WinAPI_ShowWindow($winarray[$i][0], @SW_MAXIMIZE)
		 _WinAPI_ShowWindow($winarray[$i][0], @SW_SHOWNORMAL)
	 EndIf
Next
EndFunc


EDIT for clarification:  WinTitleMatchMode will only apply to the Main Window in:   ChildActivate("Main Window", "Child Window")

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>