BatMan22 Posted December 27, 2017 Author Share Posted December 27, 2017 Apparently the answer was to use the WinAPI, the function below works perfectly! It was NOT written by me, and the author wishes to remain anonymous but I needed it for work and was tired of failing Also the WinAPI suggestion would have worked.. but I didn't know that I had to call #include <WinAPISys.au3>, I thought the function was built in. Either way, this function is really cool for activating hard to activate windows! For my purposes, it allowed me to activate windows and also to control click windows that I previously couldn't access Keep in mind that _GetICNetMDIWindows needs to be run to update the window list array every time a new window appears that you need to call! Happy hunting fellas and thank you for the help! expandcollapse popup#RequireAdmin #include <Array.au3> #include <WinAPISys.au3> Global $aMDIWindows[0] Global $sParentWindowTitle = "IC Net" _GetICNetMDIWindows() ;this will get All the required MDI Childs windows If Not IsArray($aMDIWindows) Then Exit MsgBox(0, "Error", "Unable To get the Child Windows") ;Here you just add the window title and the control ID to be clicked.(just for testing) WinActivate(_GetMDIHandlebyTitle("test")); activate the window ControlClick(_GetMDIHandlebyTitle("test"), "", "CCBitmap8", "left", 2) ;click the control Func _GetICNetMDIWindows() Local $hParentWindow = WinActivate("IC Net") Local $aData = _WinAPI_EnumChildWindows($hParentWindow) ;~ _ArrayDisplay($aData) If IsArray($aData) Then ReDim $aMDIWindows[$aData[0][0]][2] ;handle;title Local $iIndexBound = 0 For $i = 1 To $aData[0][0] If StringInStr($aData[$i][1], "#32770") Then ;~ ConsoleWrite(WinGetTitle($aData[$i][0]) & @CRLF) $aMDIWindows[$iIndexBound][0] = $aData[$i][0] $aMDIWindows[$iIndexBound][1] = WinGetTitle($aData[$i][0]) $iIndexBound += 1 EndIf Next ReDim $aMDIWindows[$iIndexBound][2] If Not UBound($aMDIWindows) Then $aMDIWindows = 0 EndIf EndFunc ;==>_GetICNetMDIWindows Func _GetMDIHandlebyTitle($sTitle) Local $iFind = _ArraySearch($aMDIWindows, $sTitle) If $iFind > -1 Then Return $aMDIWindows[$iFind][0] Else Return 0 EndIf EndFunc ;==>_GetMDIHandlebyTitle 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