Fiinguer Posted September 8, 2020 Posted September 8, 2020 Hello Guys, I am struggling with this a while. I use an app in my office and I am trying to automate some work. I need to select a row and then open the contextmenu to select "View Forecast", but I can't discover how to do this. What I have today is: expandcollapse popupFunc Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "WindowsForms10.Window.8.app.0.13965fa_r9_ad1", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Children, $pCondition0, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "WindowsForms10.Window.20808.app.0.13965fa_r9_ad1", $pCondition3 ) If Not $pCondition3 Then Return ConsoleWrite( "$pCondition3 ERR" & @CRLF ) ConsoleWrite( "$pCondition3 OK" & @CRLF ) Local $pMenu1, $oMenu1 $oWindow1.FindAll( $TreeScope_Descendants, $pCondition3, $pMenu1 ) $oMenu1 = ObjCreateInterface( $pMenu1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oMenu1 ) Then Return ConsoleWrite( "$oMenu1 ERR" & @CRLF ) ConsoleWrite( "$oMenu1 OK" & @CRLF ) EndFunc Every time I run the code I get "$oMenu1 ERR". Any help? Attached images containing where I have to select the item from contextmenu, and properties from the main app and the contextmenu.
Zedna Posted September 8, 2020 Posted September 8, 2020 As first step search this forum for "ContextMenu" or "Context Menu" ... Resources UDF ResourcesEx UDF AutoIt Forum Search
Fiinguer Posted September 8, 2020 Author Posted September 8, 2020 5 hours ago, Zedna said: As first step search this forum for "ContextMenu" or "Context Menu" ... I searched everywhere and I just found throught mouse clicks and position, that is not what I want right now. Any further support for me?
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