Jump to content

IUIAutomation MS framework automate chrome, FF, IE, ....


junkew
 Share

Recommended Posts

i could!!

i change this

local $text = _UIA_GetPropertyValue("Title:=CORPORATIVE_CUSTOMERCUSTOMERCONTRACT row 1;controltype:=UIA_CustomControlTypeId;class:=","UIA_LegacyIAccessibleValue");
    InputBox("",$text)

for this

local $text = _UIA_GetPropertyValue("Title:=CORPORATIVE_CUSTOMERCUSTOMERCONTRACT row 1;controltype:=UIA_CustomControlTypeId;class:=",$UIA_LegacyIAccessibleValuePropertyId);
    InputBox("",$text)

 

Link to comment
Share on other sites

Better to ask in general help and support

Its a matter of coding style 

$object=_UIA_getObjectByFindAll($UIA_oDesktop, "<Your identification here>", $treescope_children)
 
 _UIA_Action($object,"highlight") ; or setfocus or click or ......
 
 $text = _UIA_GetPropertyValue($object,$UIA_LegacyIAccessibleValuePropertyId);

Not in current wrappers but you could add

case "propertyvalue","property"
            local $i=_UIA_getPropertyIndex($p1)
            if not @error then
                $retValue=_UIA_getPropertyValue($UIA_oUIElement, $UIA_propertiesSupportedArray[$i][1])
            Else
                $retValue=_UIA_getPropertyValue($obj2ActOn, $p1)
            EndIf

then syntax like this can work

$text = _UIA_Action($object,"property","IAccessibleValue");

 

Link to comment
Share on other sites

  • 2 weeks later...

Thanks, junkew, and the rest of the forum members for sharing this work! When the AutoIt spy tool began to fail to discover controls wrapped in WPF and others a few years back, I was hoping that some way to work with these using AutoIt would become available. A few days ago, I was struggling with some windows and controls having elements that were not fully exposed to the API, when I stumbled across a freeware spy tool that could not only "see" all of these controls, but allows manipulation of their attributes as well. I'm not at my workstation just now, but I'll post the name of the tool when I get to work. Anyway, I'm wondering if this freeware tool employs UIA methods to traverse the control hierarchy like junkew's advanced spy tool does?

 

Link to comment
Share on other sites

50 minutes ago, mbunds said:

Thanks, junkew, and the rest of the forum members for sharing this work! When the AutoIt spy tool began to fail to discover controls wrapped in WPF and others a few years back, I was hoping that some way to work with these using AutoIt would become available. A few days ago, I was struggling with some windows and controls having elements that were not fully exposed to the API, when I stumbled across a freeware spy tool that could not only "see" all of these controls, but allows manipulation of their attributes as well. I'm not at my workstation just now, but I'll post the name of the tool when I get to work. Anyway, I'm wondering if this freeware tool employs UIA methods to traverse the control hierarchy like junkew's advanced spy tool does?

 

for me best app to explore UI elements is "UISpy.exe" from "ui-inspect-tool-master.zip" package

Link to comment
Share on other sites

UISpy.exe is superseded with inspect.exe. My simplespy can easily be enhanced with more tricks. Its on my TODO list as based on IUIAutomation DLL you can reveal all information you want. People studying all examples should be able to make a more advanced element spy.

Link to comment
Share on other sites

  • 3 weeks later...

Thank you for you post. But it's too long for me. My English not good, I can understand all of them. Can you share me an example file for click and send the key to chrome?
I want to make app can auto fill form. Please share me if you know some code :D 
Thank you :) 

Link to comment
Share on other sites

On 11/2/2016 at 6:04 AM, JaysCogs said:

Hey, sorry, I hope this script is still being supported. I've followed the above directions, installed the autoit extension in developer mode, and allowed it access to file URL's, however running the first example script still doesn't work. Have things changed? I'm honestly not sure where to go from here.

 

Thank you for you post. But it's too long for me. My English not good, I can understand all of them. Can you share me an example file for click and send the key to chrome?
I want to make app can auto fill form. Please share me if you know some code :D 
Thank you :) 

Link to comment
Share on other sites

On 4/30/2016 at 1:09 PM, junkew said:

UISpy.exe is superseded with inspect.exe. My simplespy can easily be enhanced with more tricks. Its on my TODO list as based on IUIAutomation DLL you can reveal all information you want. People studying all examples should be able to make a more advanced element spy.

The freeware utility I found is called "Window Detective", and can be found at windowdetective.sourceforge.net.

Inspect.exe is very useful, but I really like the feature set and layout of Window Detective. 

Link to comment
Share on other sites

  • 1 month later...
On 6/29/2016 at 7:12 PM, junkew said:

Yes, still using it and working on it. Whats not working?

Everything works great. :)
I was wondering if development was still active (https://github.com/jvanegmond/au3_uiautomation) and what are the new features?

Link to comment
Share on other sites

Moved to a new machine and need to update a script but I've forgotten where I edited the include file to stop the log files from being created in my compiled program. It was one line but I don't remember if it was in UIAWrappers file or some compiler script file. my program is ran a few hundred times a week and every time it runs it creates a log. Going to hold off on my update until I find where.  

Link to comment
Share on other sites

7 hours ago, asdf1nit said:

Moved to a new machine and need to update a script but I've forgotten where I edited the include file to stop the log files from being created in my compiled program. It was one line but I don't remember if it was in UIAWrappers file or some compiler script file. my program is ran a few hundred times a week and every time it runs it creates a log. Going to hold off on my update until I find where.  

try this

 

Link to comment
Share on other sites

New version 0.63 attached to first post with examples and simplespy giving a little more code out of the box when you spy to have a jump start.

So for example on windows 10 automation of starting edge from start menu

1. First spy on start button and copy paste code to a new script

2. Spy on microsoft edge icon in the popped up start menu

First source

;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=;controltype:=UIA_PaneControlTypeId;class:=Shell_TrayWnd")    ;

_UIA_setVar("Starten.mainwindow","title:=Starten;classname:=Start")

;~ Actions split away from logical/technical definition above can come from configfiles 

;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")

_UIA_action("Starten.mainwindow","setfocus")

Second source

;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=Start;controltype:=UIA_WindowControlTypeId;class:=Windows.UI.Core.CoreWindow")    ;Start
_UIA_setVar("oP2","Title:=Apps in Start;controltype:=UIA_ListControlTypeId;class:=TileListView")    ;Apps in Start
_UIA_setVar("oP3","Title:=Groepskoptest Het leven in één oogopslag;controltype:=UIA_ListControlTypeId;class:=TileListViewItem")   ;Groepskoptest Het leven in één oogopslag

;~ $oUIElement=_UIA_getObjectByFindAll("MicrosoftEdge.mainwindow", "title:=Microsoft Edge;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Microsoft Edge;controltype:=UIA_ListItemControlTypeId;class:=TileListViewItem") ;ControlType:=UIA_ListItemControlTypeId;classname:=TileListViewItem")

;~ Actions split away from logical/technical definition above can come from configfiles 

;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")
;~_UIA_Action("oP2","highlight")
_UIA_Action("oP2","setfocus")
;~_UIA_Action("oP3","highlight")
_UIA_Action("oP3","setfocus")

;~_UIA_action($oUIElement","highlight")
;~_UIA_action($oUIElement,"click")
;~_UIA_action("oUIElement","highlight")
;~_UIA_action("oUIElement","click")

And when you combine above and clean you get a script like this

;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=Start;controltype:=UIA_WindowControlTypeId;class:=Windows.UI.Core.CoreWindow")    ;Start
_UIA_setVar("oP2","Title:=Apps in Start;controltype:=UIA_ListControlTypeId;class:=TileListView")    ;Apps in Start
_UIA_setVar("oP3","Title:=Groepskoptest Het leven in één oogopslag;controltype:=UIA_ListControlTypeId;class:=TileListViewItem")   ;Groepskoptest Het leven in één oogopslag

;~ $oUIElement=_UIA_getObjectByFindAll("MicrosoftEdge.mainwindow", "title:=Microsoft Edge;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Microsoft Edge;controltype:=UIA_ListItemControlTypeId;class:=TileListViewItem") ;ControlType:=UIA_ListItemControlTypeId;classname:=TileListViewItem")

;~ Be aware that tree hierarchy changes as such simple spy will not give below
_UIA_setVar("oTaskbar","Title:=;controltype:=UIA_PaneControlTypeId;class:=Shell_TrayWnd")   ;
_UIA_setVar("oStartbutton","title:=Starten;classname:=Start")


;~ Actions split away from logical/technical definition above can come from configfiles
_UIA_Action("oTaskbar","setfocus")
_UIA_Action("oStartButton","click")
sleep(500)
;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")
;~_UIA_Action("oP2","highlight")
_UIA_Action("oP2","setfocus")
;~_UIA_Action("oP3","highlight")
_UIA_Action("oP3","setfocus")

;~_UIA_action($oUIElement","highlight")
;~_UIA_action($oUIElement,"click")
_UIA_action("oUIElement","setfocus")
sleep(500)
;~_UIA_action("oUIElement","click")

 

Edited by junkew
Link to comment
Share on other sites

  • 3 weeks later...

@junkew

Does The UIA Wrapper have functions that would take the place of GUICtrlListBox_SetCurSel so that I would be able to scroll and item into view. I am able to use the wrapper to select items that are in view but I cannot scroll to items that are not in view so Is there a way to accomplish this. Here is the code I have so far

scrollThroughList.au3

Link to comment
Share on other sites

Here it is without the download Link... sorry about that I am new to the forum.
Local $UIA_winApp  = _UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Generic Windows App;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow", $treescope_subtree)
    Local $UIA_ListBox = _UIA_getObjectByFindAll($UIA_opt, "Title:=;controltype:=UIA_ListControlTypeId;class:=ListView", $treescope_subtree)
    Local $UIA_listItem = _UIA_getObjectByFindAll($UIA_opt, "Title:=Generic List Item;controltype:=UIA_TextControlTypeId;class:=TextBlock", $treescope_subtree)

    if isobj( $UIA_listItem) Then
       consolewrite ( "Choosing Item... " & @CRLF )
    Else
       consolewrite ( "Error Item not found " )
       exit
    EndIf

    _UIA_Action ( $UIA_listItem , "setfocus" )
    _UIA_Action ( $UIA_listItem , "click" )

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...