Jump to content

mikester

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by mikester

  1. Thanks junkew. My problem was that there is nothing unique about the parent, grandparent, or great grandparent. They all have the same properties so I needed a way to just get the parent directly.
  2. I worked it out. I looked at ex1_Treewalker.au3 from junkew a little closer and that got me to this: Local $pRawWalker, $oRawWalker $oUIAutomation.RawViewWalker( $pRawWalker ) $oRawWalker = ObjCreateInterface( $pRawWalker, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker ) Local $pTreeNodeItem1, $oTreeNodeItem1 $oRawWalker.GetParentElement( $pText1, $pTreeNodeItem1) $oTreeNodeItem1 = ObjCreateInterface( $pTreeNodeItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oTreeNodeItem1 ) Then Return ConsoleWrite( "$oTreeNodeItem1 ERR" & @CRLF ) ConsoleWrite( "$oTreeNodeItem1 OK" & @CRLF ) Hope I didn't waste anyone's time.
  3. If it helps, here's the latest section of code I tried, although I think I was closer prior to trying this: Local $pRawWalker, $oRawWalker $oUIAutomation.RawViewWalker( $pRawWalker ) $oRawWalker = ObjCreateInterface( $pRawWalker, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker ) Local $pTreeNodeItem1, $oTreeNodeItem1 $oRawWalker.GetParentElement( $pText1, $pTreeNodeItem1) $oTreeNodeItem1 = ObjCreateInterface( $pTreeNodeItem1, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker ) If Not IsObj( $oTreeNodeItem1 ) Then Return ConsoleWrite( "$oTreeNodeItem1 ERR" & @CRLF ) ConsoleWrite( "$oTreeNodeItem1 OK" & @CRLF )
  4. This is fantastic, great work! Any chance I could get some help w/how to locate a parent element? Maybe just a small example? I've tried to work out the syntax for a couple of days and still cannot figure it out. I'm able to locate the element by name but that shows as the $UIA_NamePropertyId (Text) and there are 3 siblings for: the Button (to expand/collapse), Image (the folder), and "Edit: TextBox". What I need to be able to do is select the parent element so that its properties show up on the screen. Any help would be GREATLY appreciated! This is the last piece of the puzzle before I can automate the entire project. Thanks in advance!!! I forgot to mention I working w/a tree, if that matters.
  5. I know this is an old thread but I came across it and this could be a HUGE help to what I'm doing, except I can't quite get it working. I want to automate a windows application that uses wpf and winforms so I was using CUIAutomation2.au3 by junkew and that worked great. Now I have a need to integrate this into another testing tool that can use Java, Python, or C#. Our dev team uses C# so I was leaning in that direction. Anyways, using this com server approach I was able to launch our application but when I tried to call functions like GetRootElement and FindFirst, I couldn't quite figure out the syntax. Here's a code sample: dynamic myAu3Object = Marshal.BindToMoniker("AutoIt.Application"); // Create UI Automation object dynamic oUIAutomation = myAu3Object.Call("ObjCreateInterface", "$sCLSID_CUIAutomation", "$sIID_IUIAutomation", "$dtagIUIAutomation"); // Get Desktop element dynamic pDesktop = null; myAu3Object.Call("oUIAutomation.GetRootElement", pDesktop); var oDesktop = myAu3Object.Call("ObjCreateInterface", pDesktop, "$sIID_IUIAutomationElement", "$dtagIUIAutomationElement"); I don't believe pDesktop gets filled properly b/c if I write out oDesktop to the console it always returns '1'. I've tried a bunch of variations of the syntax but can't quite wrap my head around the proper way to do it, or if it's even possible. I'm still learning AutoIt and have very little knowledge of C# so I'm a bit over my head but would dive right in if I knew it could work. It looks like both of those functions set the value of a variable sent to them but I'm not sure I have access to those values back in C#. Can anyone confirm that? If more details are needed please let me know. My alternative is to create a bunch of small au3 scripts, convert them to exe files and call them externally but I was hoping to avoid that if I could. Any help would be greatly appreciated!
×
×
  • Create New...