Jump to content

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


junkew
 Share

Recommended Posts

Hi junknew.

Thanks for your help.

Is possible to set the font size off a WindowsForms10.RichEdit20W.app.0.13965fa_r26_ad1 to this format (16, Calibri), using your UDF? I´m already try use the function _GUICtrlRichEdit_SetFont, but the program with the richedit always hangs. Regards.

Quote

_GUICtrlRichEdit_SetSel($hRichEdit, 0, -1)
_GUICtrlRichEdit_SetFont($hRichEdit,16,"Calibri")
_GUICtrlRichEdit_Deselect($hRichEdit) ; deselect all

 

Link to comment
Share on other sites

It should be possible with the textrange pattern.

See https://msdn.microsoft.com/en-us/library/windows/desktop/ee872119(v=vs.85).aspx

I do not have an example of it. For sure you cannot mix in general the autoit functions with the functions of this udf.

Edited by junkew
Link to comment
Share on other sites

7 hours ago, junkew said:

It should be possible with the textrange pattern.

See https://msdn.microsoft.com/en-us/library/windows/desktop/ee872119(v=vs.85).aspx

I do not have an example of it. For sure you cannot mix in general the autoit functions with the functions of this udf.

Hi.

Thanks a lot for your help.  I try to use this function code, but no sucess. I will try to use another autoit functions.

Quote

_UIA_getPropertyValue($oUIElement, $UIA_FontSizeAttributeId)

 

Link to comment
Share on other sites

  1. Check with simplespy if textrange pattern is true. Post full output of simplespy can help.
  2. If true get the textrange patternobject
  3. Use the functions of the textrange object.

Not sure if i ever validated the interfaces for the textpattern interface.

Link to comment
Share on other sites

On 3/1/2018 at 10:35 AM, junkew said:
  1. Check with simplespy if textrange pattern is true. Post full output of simplespy can help.
  2. If true get the textrange patternobject
  3. Use the functions of the textrange object.

Not sure if i ever validated the interfaces for the textpattern interface.

Hi.

Here is the output of simplespy. It´s say "UIA_IsTextPatternAvailable:= <False>". So, i cannot format the size of text. It´s right? Regards.

Quote

*** Detailed properties of the highlighted element ***
UIA_class:= <WindowsForms10.RichEdit20W.app.0.13965fa_r26_ad1>
UIA_regexpclass:= <WindowsForms10.RichEdit20W.app.0.13965fa_r26_ad1>
UIA_iaccessiblevalue:= <test>
UIA_iaccessiblechildId:= <0>
UIA_id:= <edit1>
UIA_handle:= <66452>
UIA_RuntimeId:= <42;66452>
UIA_BoundingRectangle:= <125;204;964;120>
UIA_ProcessId:= <5352>
UIA_ControlType:= <50004>
UIA_LocalizedControlType:= <Edit>
UIA_HasKeyboardFocus:= <True>
UIA_IsKeyboardFocusable:= <True>
UIA_IsEnabled:= <True>
UIA_AutomationId:= <edit1>
UIA_ClassName:= <WindowsForms10.RichEdit20W.app.0.13965fa_r26_ad1>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <66452>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_FrameworkId:= <WinForm>
UIA_IsRequiredForForm:= <False>
UIA_IsDockPatternAvailable:= <False>
UIA_IsExpandCollapsePatternAvailable:= <False>
UIA_IsGridItemPatternAvailable:= <False>
UIA_IsGridPatternAvailable:= <False>
UIA_IsInvokePatternAvailable:= <False>
UIA_IsMultipleViewPatternAvailable:= <False>
UIA_IsRangeValuePatternAvailable:= <False>
UIA_IsScrollPatternAvailable:= <True>
UIA_IsScrollItemPatternAvailable:= <False>
UIA_IsSelectionItemPatternAvailable:= <False>
UIA_IsSelectionPatternAvailable:= <False>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <False>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <True>
UIA_IsWindowPatternAvailable:= <False>
UIA_ValueValue:= <test>
UIA_ValueIsReadOnly:= <False>
UIA_RangeValueValue:= <0>
UIA_RangeValueIsReadOnly:= <True>
UIA_RangeValueMinimum:= <0>
UIA_RangeValueMaximum:= <0>
UIA_RangeValueLargeChange:= <0>
UIA_RangeValueSmallChange:= <0>
UIA_ScrollHorizontalScrollPercent:= <0>
UIA_ScrollHorizontalViewSize:= <100>
UIA_ScrollVerticalScrollPercent:= <0>
UIA_ScrollVerticalViewSize:= <91.6030534351145>
UIA_ScrollHorizontallyScrollable:= <False>
UIA_ScrollVerticallyScrollable:= <True>
UIA_SelectionCanSelectMultiple:= <False>
UIA_SelectionIsSelectionRequired:= <False>
UIA_GridRowCount:= <0>
UIA_GridColumnCount:= <0>
UIA_GridItemRow:= <0>
UIA_GridItemColumn:= <0>
UIA_GridItemRowSpan:= <1>
UIA_GridItemColumnSpan:= <1>
UIA_DockDockPosition:= <5>
UIA_ExpandCollapseExpandCollapseState:= <3>
UIA_MultipleViewCurrentView:= <0>
UIA_WindowCanMaximize:= <False>
UIA_WindowCanMinimize:= <False>
UIA_WindowWindowVisualState:= <0>
UIA_WindowWindowInteractionState:= <0>
UIA_WindowIsModal:= <False>
UIA_WindowIsTopmost:= <False>
UIA_SelectionItemIsSelected:= <False>
UIA_TableRowOrColumnMajor:= <2>
UIA_ToggleToggleState:= <2>
UIA_TransformCanMove:= <False>
UIA_TransformCanResize:= <False>
UIA_TransformCanRotate:= <False>
UIA_IsLegacyIAccessiblePatternAvailable:= <True>
UIA_LegacyIAccessibleChildId:= <0>
UIA_LegacyIAccessibleValue:= <test>
UIA_LegacyIAccessibleRole:= <42>
UIA_LegacyIAccessibleState:= <1048580>
UIA_IsDataValidForForm:= <False>
UIA_ProviderDescription:= <[pid:5404,hwnd:0x10394 Main:Nested [pid:5352,hwnd:0x10394 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Nonclient:Microsoft: Non-Client Proxy (unmanaged:uiautomationcore.dll); Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]>
UIA_IsItemContainerPatternAvailable:= <False>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <False>

 

 

Link to comment
Share on other sites

I am not an expert in the MS rich edit controls but I know you can manipulate them with sendmessage EM_SETPARAFORMAT / EM_GETPARAFORMAT message and a lot of other messages by dealing with wparam and lparam

https://msdn.microsoft.com/en-us/library/windows/desktop/bb774182(v=vs.85).aspx

But you are right you cannot do it with UIA as there is no textpattern

 

I would expect  _GUICtrlRichEdit_SetFont($hRichEdit,16,"Calibri")  to use sendmessage/postmessage under the hood but not fully sure.
Maybe your $hRichEdit handle is not the control handle.

Link to comment
Share on other sites

8 hours ago, junkew said:

I am not an expert in the MS rich edit controls but I know you can manipulate them with sendmessage EM_SETPARAFORMAT / EM_GETPARAFORMAT message and a lot of other messages by dealing with wparam and lparam

https://msdn.microsoft.com/en-us/library/windows/desktop/bb774182(v=vs.85).aspx

But you are right you cannot do it with UIA as there is no textpattern

 

I would expect  _GUICtrlRichEdit_SetFont($hRichEdit,16,"Calibri")  to use sendmessage/postmessage under the hood but not fully sure.
Maybe your $hRichEdit handle is not the control handle.

Hi.

Thanks for your help. I try to work in autoit, but everytimes i can put a thing working, another breaks. I think it´s because the program where are the controls that i want to format. When i use the function _GUICtrlRichEdit_SetFont, it sometimes format the font, but if i use the function again, the program hangs. Regards.

Link to comment
Share on other sites

I kept on searching for ways to make the search faster when there are 6000 results, and your needed object is like 5000th, but couldnt find any. So I just wrote a function to search from the rear and thought it might be useful to someone else(like me) as well, so I will post it here. Bare in mind that Im not a programmer of any kind and my code sucks a lot, but hey, you guys know your stuff so you might tweak it for your own use. The code is pretty dirty as well ^^; 
This crappy function can only search filter ControlTypeId, Name and IndexRelative(int) and will give the object found in $oReverseSearch

Func ReverseSearch($oElementStart, $TreeScope, $ControlType = "", $Name = "", $IndexRelative = "") ;Object, TreeScope, ControlTypeId, Name, IndexRelative(Int)
   local $oCondition, $pTrueCondition
   local $pElements, $iLength

   $UIA_oUIAutomation.CreateTrueCondition($pTrueCondition)
   $oCondition = ObjCreateInterface($pTrueCondition, $sIID_IUIAutomationCondition, $dtagIUIAutomationCondition)
   $oElementStart.FindAll($TreeScope, $oCondition, $pElements)

   local $oAutomationElementArray = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray)

   $oAutomationElementArray.Length($iLength)
   For $i = 0 To $iLength - 1; its zero based
      local $Match1 = 0
      local $Match2 = 0
      local $iReverse = $iLength - 1 - $i ;Reversing the order of the search

      $oAutomationElementArray.GetElement($iReverse, $UIA_pUIElement)

      local $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
      local $FoundControlTypePropertyId = _UIA_getPropertyValue($oUIElement, $UIA_ControlTypePropertyId)
      local $FoundNamePropertyId = _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)

      If $ControlType <> "" Then
         If $FoundControlTypePropertyId = $ControlType Then
            $Match1 = 1
         EndIf
      Else
         $Match1 = 1
      EndIf
      If $Name <> "" Then
         If $FoundNamePropertyId = $Name Then
            $Match2 = 1
         EndIf
      Else
         $Match2 = 1
      EndIf

      If $Match1 = 1 And $Match2 = 1 Then
         If $IndexRelative <> "" And IsInt($IndexRelative) Then
            $iReverse = $iReverse + $IndexRelative
            $oAutomationElementArray.GetElement($iReverse, $UIA_pUIElement)
            local $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
            local $FoundControlTypePropertyId = _UIA_getPropertyValue($oUIElement, $UIA_ControlTypePropertyId)
            local $FoundNamePropertyId = _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)
         EndIf
         $oReverseSearch = $oUIElement
         ConsoleWrite("Object found!" & @CRLF)
         ConsoleWrite("Name: <" & $FoundNamePropertyId & "> ")
         ConsoleWrite("ControlType: <" & $FoundControlTypePropertyId & "> ")
         If $IndexRelative <> "" And IsInt($IndexRelative) Then
            ConsoleWrite("IndexRelative: <" & $IndexRelative & "> ")
         EndIf
         ConsoleWrite("Reversed Position: <" & $iReverse & ">" & @CRLF)
         ExitLoop
      EndIf
   Next
EndFunc

If someone can improve on this please do and let me know ^^

Link to comment
Share on other sites

  • 2 weeks later...

Good Day junkew,

Thank you for your amazing work. I see that you include  a "getvalue" command. However, is there a way to get a "Name" value somehow?

 

my code

#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

Local $oP4=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=GOLDCORP - Gold Ore Mining", $treescope_children)
_UIA_Action($oP4,"setfocus")
Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=Tab", $treescope_children)
_UIA_Action($oP3,"setfocus")
Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=Pane", $treescope_children)
_UIA_Action($oP2,"setfocus")
Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=Pane", $treescope_children)
_UIA_Action($oP2,"setfocus")

Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=Text;instance:= 4", $treescope_children)
_UIA_Action($oP1,"setfocus")


local $oUIElement=_UIA_getObjectByFindAll($oP1, "controltype:=Text", $treescope_subtree)

Local $string = _UIA_action($oUIElement,"!!! GET NAME !!!")                 <--------------------------- Thats what i need :(
MsgBox($MB_OK,"", $string)

 

Capture.PNG

Link to comment
Share on other sites

@toto22 see first post. getvalue should work. Advice to do first ac5ion highlight to see you find the right object to interact with.

@MrCheese try simplespy on your object andvask for help in support forum. Examples frequently fail due to os language setting.

Link to comment
Share on other sites

Hi Junkew, to add to my post earlier. I am in example 4, adjusting the script to suit.

I'm getting this error:

Menuitem is NOT there"C:\Users\60080462\Google Drive\Work stuff\Macros\EXAMPLES_V0_64\ex4_calculator.au3" (119) : ==> Variable must be of type "Object".:
$oInvokeP.Invoke
$oInvokeP^ ERROR

 

the line above refers to: $oInvokeP=_UIA_getpattern($oButton,$UIA_InvokePatternID)

and $oButton is last used here:

local $sText="((Copy.*)|(Kopi.*))"    ;Copy
    $oButton=_UIA_getObjectByFindAll($oCalc,"name:=" & $sText, $treescope_subtree)
    if isobj($oButton) Then
        consolewrite("Menuitem is there")
    Else
        consolewrite("Menuitem is NOT there")
    EndIf
    sleep(2000)

 

so this implies that the script isn't able to find "Copy" or "Kopi". What is this part of the script attempting to do, and what do I need to change in order for it to continue?

One big question, what detail am I looking for when I am looking in simplyspy to extract the details of the field/box/button that I am currently mouseover, in order to select and enter in detail that I wish to enter in?

What is the command to read back text that has been entered into a field (or that is prepopulated)?

 

Ultimately, I need to develop a script that can:

* click buttons
* wait for the webpage to refresh before proceeding

*enter text into fields

* read text from fields.

 

Relating to your point about asking on the forum, would you suggest separate threads for each issue, or should I include example discussions in this thread since its related to the examples you posted?

 

Thanks

 

 

 

Link to comment
Share on other sites

Within chrome you should put accessibility to true. Then with simplespy you should see your element highlight. If it highlights you can access it. As it looks html page normally its accessible.

The error you see is due to object not found with the regular expression that you try. First automate calc.exe or google.com before you start on other pages,

 

Link to comment
Share on other sites

  • 2 weeks later...

Okay, first of all I would like to commend junkew for this great tool.  

I have run into a little snag that I can't seem to figure out. Below is a snippet of my code. The script works great up until this point of getting me into our customer's data page. The purpose of this piece is to grab data from what is displayed so we can analyze it before making changes and to also save the "before" data before we update in case we ever have to roll back the data. The part that is giving me an issue is the "getValue" in the code that reads from the text control. SimplySpy identified the control properly and shows the information in it correctly. But, when I write the data to the console it will show me something random.  For this piece of code, it actually shows me code from the script. Which I don't even understand how it's coming up with that. I can read the contents of the edit controls fine, it's just the text controls that are giving me a problem. I need to be able to read them to make sure I'm on the right product before attempting to make any changes.

Any help and/or suggestions from anyone would be greatly appreciated as I can't seem to get past this issue.

 

$oChrome = _UIA_getFirstObjectOfElement($UIA_oDesktop, "class:=Chrome_WidgetWin_1", $treescope_children)
   $oDocument = _UIA_getFirstObjectOfElement($oChrome, "controltype:=" & $UIA_DocumentControlTypeId, $treescope_subtree)

   Local $oRVTest = _UIA_getObjectByFindAll($oDocument, "controltype:=" & $UIA_TextControlTypeId & ";Index:=2", $treescope_subtree)
   Local $sRVTest = _UIA_Action($oRVTest, "getValue")
   ConsoleWrite($sRVTest & @CRLF)

;   $oPartID = _UIA_getObjectByFindAll($oDocument, "controltype:=" & $UIA_TextControlTypeId & ";Index:=3", $treescope_subtree)
;   $sPartID = _UIA_Action("$oPartID", "getValue")
;   ConsoleWrite($sPartID & @CRLF)

   Local $oDescription = _UIA_getObjectByFindAll($oDocument, "controltype:=" & $UIA_EditControlTypeId & ";Index:=1", $treescope_subtree)
   Local $sDescription = _UIA_Action($oDescription, "getValue")
   ConsoleWrite($sDescription & @CRLF)

   Local $oBin = _UIA_getObjectByFindAll($oDocument, "controltype:=" & $UIA_EditControlTypeId & ";Index:=2", $treescope_subtree)
   Local $sBin = _UIA_Action($oBin, "getValue")
   ConsoleWrite($sBin & @CRLF)

 

Link to comment
Share on other sites

Okay, here's what SimpleSpy gives me.

In my script, I can read the contents of an edit control fine, it's the text control that I'm having an issue with. In SimpleSpy it shows that I should be able to get the value.

https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/?do=findComment&comment=1156373 
At least we have an element title: [Part Number Entry] class: []

Having the following values for all properties: 
Title is:= <Part Number Entry>
Class:= <>
Control Type:= <UIA_TextControlTypeId>
ID:= <50020>    Hex ID (0000C364)
Position & Size:= 468;300;197;24

*** Parent Information top down ***
6: Title is: <BS1-My Favorites>
Class:= <Chrome_WidgetWin_1>
Control Type:= <UIA_WindowControlTypeId>
ID:= <50032>    Hex ID (0000C370)
Position & Size:= 21;20;1663;1056

"Title:=BS1-My Favorites;
controltype:=UIA_WindowControlTypeId;
class:=Chrome_WidgetWin_1"" 
5: Title is: <BS1-My Favorites>
Class:= <Chrome_RenderWidgetHostHWND>
Control Type:= <UIA_DocumentControlTypeId>
ID:= <50030>    Hex ID (0000C36E)
Position & Size:= 29;105;1647;963

"Title:=BS1-My Favorites;
controltype:=UIA_DocumentControlTypeId;
class:=Chrome_RenderWidgetHostHWND""    
4: Title is: <>
Class:= <>
Control Type:= <UIA_CustomControlTypeId>
ID:= <50025>    Hex ID (0000C369)
Position & Size:= 29;105;1647;808

"Title:=;
controltype:=UIA_CustomControlTypeId;
class:=""   
3: Title is: <>
Class:= <>
Control Type:= <UIA_CustomControlTypeId>
ID:= <50025>    Hex ID (0000C369)
Position & Size:= 29;140;1647;773

"Title:=;
controltype:=UIA_CustomControlTypeId;
class:=""   
2: Title is: <>
Class:= <>
Control Type:= <UIA_CustomControlTypeId>
ID:= <50025>    Hex ID (0000C369)
Position & Size:= 372;263;961;688

"Title:=;
controltype:=UIA_CustomControlTypeId;
class:=""   
1: Title is: <Part Number Entry GM :AD1000                     Description GEAR OIL Non-Stocked                                                                                            On Hand 0 Last Sale 10/01/13 In Invent     Stock Group* 203 Phased Out 3/07/15 Group Cost Stock Status                      Trade        Order Status                                List 27.68 Minimum Flat Price Maximum Comp 1 Pack Quantity 1 Comp 2 Low Year Update* Y High Year Prog Code   Reman Ind New             Return Code Price Guide Promo Code*  Taxable*   Y Remarks/Dsp Function* Ok Exit Cancel Bin/Shelf* >
Class:= <>
Control Type:= <UIA_CustomControlTypeId>
ID:= <50025>    Hex ID (0000C369)
Position & Size:= 382;289;1023;616

"Title:=Part Number Entry GM :AD1000                     Description GEAR OIL Non-Stocked                                                                                            On Hand 0 Last Sale 10/01/13 In Invent     Stock Group* 203 Phased Out 3/07/15 Group Cost Stock Status                      Trade        Order Status                                List 27.68 Minimum Flat Price Maximum Comp 1 Pack Quantity 1 Comp 2 Low Year Update* Y High Year Prog Code   Reman Ind New             Return Code Price Guide Promo Code*  Taxable*   Y Remarks/Dsp Function* Ok Exit Cancel Bin/Shelf* ;
controltype:=UIA_CustomControlTypeId;
class:=""   
0: Title is: <>
Class:= <>
Control Type:= <UIA_CustomControlTypeId>
ID:= <50025>    Hex ID (0000C369)
Position & Size:= 467;299;199;26

"Title:=;
controltype:=UIA_CustomControlTypeId;
class:=""   


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

_UIA_setVar("oP1","Title:=BS1-My Favorites;
controltype:=UIA_WindowControlTypeId;
class:=Chrome_WidgetWin_1") ;BS1-My Favorites
_UIA_setVar("oP2","Title:=BS1-My Favorites;
controltype:=UIA_DocumentControlTypeId;
class:=Chrome_RenderWidgetHostHWND")    ;BS1-My Favorites
_UIA_setVar("oP3","Title:=;
controltype:=UIA_CustomControlTypeId;
class:=")   ;
_UIA_setVar("oP4","Title:=;
controltype:=UIA_CustomControlTypeId;
class:=")   ;
_UIA_setVar("oP5","Title:=;
controltype:=UIA_CustomControlTypeId;
class:=")   ;
_UIA_setVar("oP6","Title:=Part Number Entry GM :AD1000                     Description GEAR OIL Non-Stocked                                                                                            On Hand 0 Last Sale 10/01/13 In Invent     Stock Group* 203 Phased Out 3/07/15 Group Cost Stock Status                      Trade        Order Status                                List 27.68 Minimum Flat Price Maximum Comp 1 Pack Quantity 1 Comp 2 Low Year Update* Y High Year Prog Code   Reman Ind New             Return Code Price Guide Promo Code*  Taxable*   Y Remarks/Dsp Function* Ok Exit Cancel Bin/Shelf* ;
controltype:=UIA_CustomControlTypeId;
class:=")   ;Part Number Entry GM :AD1000                     Description GEAR OIL Non-Stocked                                                                                            On Hand 0 Last Sale 10/01/13 In Invent     Stock Group* 203 Phased Out 3/07/15 Group Cost Stock Status                      Trade        Order Status                                List 27.68 Minimum Flat Price Maximum Comp 1 Pack Quantity 1 Comp 2 Low Year Update* Y High Year Prog Code   Reman Ind New             Return Code Price Guide Promo Code*  Taxable*   Y Remarks/Dsp Function* Ok Exit Cancel Bin/Shelf* 
_UIA_setVar("oP7","Title:=;
controltype:=UIA_CustomControlTypeId;
class:=")   ;

;~ $oUIElement=_UIA_getObjectByFindAll("Part Number Entry.mainwindow", "title:=Part Number Entry
;ControlType:=UIA_TextControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Part Number Entry;controltype:=UIA_TextControlTypeId;class:="
) ;ControlType:=UIA_TextControlTypeId
;classname:=")

;~ 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("oP4","highlight")
_UIA_Action("oP4","setfocus")
;~_UIA_Action("oP5","highlight")
_UIA_Action("oP5","setfocus")
;~_UIA_Action("oP6","highlight")
_UIA_Action("oP6","setfocus")
;~_UIA_Action("oP7","highlight")
_UIA_Action("oP7","setfocus")

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


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

Local $oP6=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=BS1-My Favorites;
controltype:=UIA_WindowControlTypeId;
class:=Chrome_WidgetWin_1", $treescope_children)    
_UIA_Action($oP6,"setfocus")
Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=BS1-My Favorites;
controltype:=UIA_DocumentControlTypeId;
class:=Chrome_RenderWidgetHostHWND", $treescope_children)   
_UIA_Action($oP5,"setfocus")
Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=;
controltype:=UIA_CustomControlTypeId;
class:=", $treescope_children)  
Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;
controltype:=UIA_CustomControlTypeId;
class:=", $treescope_children)  
Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;
controltype:=UIA_CustomControlTypeId;
class:=", $treescope_children)  
Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=Part Number Entry GM :AD1000                     Description GEAR OIL Non-Stocked                                                                                            On Hand 0 Last Sale 10/01/13 In Invent     Stock Group* 203 Phased Out 3/07/15 Group Cost Stock Status                      Trade        Order Status                                List 27.68 Minimum Flat Price Maximum Comp 1 Pack Quantity 1 Comp 2 Low Year Update* Y High Year Prog Code   Reman Ind New             Return Code Price Guide Promo Code*  Taxable*   Y Remarks/Dsp Function* Ok Exit Cancel Bin/Shelf* ;
controltype:=UIA_CustomControlTypeId;
class:=", $treescope_children)  
Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;
controltype:=UIA_CustomControlTypeId;
class:=", $treescope_children)  
;~ First find the object in the parent before you can do something
;~$oUIElement=_UIA_getObjectByFindAll("Part Number Entry.mainwindow", "title:=Part Number Entry
;ControlType:=UIA_TextControlTypeId", $treescope_subtree)
Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Part Number Entry;ControlType:=
UIA_TextControlTypeId", $treescope_subtree)
;~_UIA_action($oUIElement,"highlight")
_UIA_action($oUIElement,"click")


*** Detailed properties of the highlighted element ***
UIA_title:= <Part Number Entry>
UIA_text:= <Part Number Entry>
UIA_regexptitle:= <Part Number Entry>
UIA_iaccessiblechildId:= <0>
UIA_handle:= <0>
UIA_BoundingRectangle:= <468;300;197;24>
UIA_ProcessId:= <7016>
UIA_ControlType:= <50020>
UIA_LocalizedControlType:= <text>
UIA_Name:= <Part Number Entry>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <False>
UIA_IsEnabled:= <True>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <0>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_IsRequiredForForm:= <False>
UIA_IsDockPatternAvailable:= <False>
UIA_IsExpandCollapsePatternAvailable:= <False>
UIA_IsGridItemPatternAvailable:= <False>
UIA_IsGridPatternAvailable:= <False>
UIA_IsInvokePatternAvailable:= <True>
UIA_IsMultipleViewPatternAvailable:= <False>
UIA_IsRangeValuePatternAvailable:= <False>
UIA_IsScrollPatternAvailable:= <False>
UIA_IsScrollItemPatternAvailable:= <False>
UIA_IsSelectionItemPatternAvailable:= <False>
UIA_IsSelectionPatternAvailable:= <False>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <False>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <False>
UIA_IsWindowPatternAvailable:= <False>
UIA_ValueIsReadOnly:= <True>
UIA_RangeValueValue:= <0>
UIA_RangeValueIsReadOnly:= <True>
UIA_RangeValueMinimum:= <0>
UIA_RangeValueMaximum:= <0>
UIA_RangeValueLargeChange:= <0>
UIA_RangeValueSmallChange:= <0>
UIA_ScrollHorizontalScrollPercent:= <0>
UIA_ScrollHorizontalViewSize:= <100>
UIA_ScrollVerticalScrollPercent:= <0>
UIA_ScrollVerticalViewSize:= <100>
UIA_ScrollHorizontallyScrollable:= <False>
UIA_ScrollVerticallyScrollable:= <False>
UIA_SelectionCanSelectMultiple:= <False>
UIA_SelectionIsSelectionRequired:= <False>
UIA_GridRowCount:= <0>
UIA_GridColumnCount:= <0>
UIA_GridItemRow:= <0>
UIA_GridItemColumn:= <0>
UIA_GridItemRowSpan:= <1>
UIA_GridItemColumnSpan:= <1>
UIA_DockDockPosition:= <5>
UIA_ExpandCollapseExpandCollapseState:= <3>
UIA_MultipleViewCurrentView:= <0>
UIA_WindowCanMaximize:= <False>
UIA_WindowCanMinimize:= <False>
UIA_WindowWindowVisualState:= <0>
UIA_WindowWindowInteractionState:= <0>
UIA_WindowIsModal:= <False>
UIA_WindowIsTopmost:= <False>
UIA_SelectionItemIsSelected:= <False>
UIA_TableRowOrColumnMajor:= <2>
UIA_ToggleToggleState:= <2>
UIA_TransformCanMove:= <False>
UIA_TransformCanResize:= <False>
UIA_TransformCanRotate:= <False>
UIA_IsLegacyIAccessiblePatternAvailable:= <True>
UIA_LegacyIAccessibleChildId:= <0>
UIA_LegacyIAccessibleName:= <Part Number Entry>
UIA_LegacyIAccessibleRole:= <41>
UIA_LegacyIAccessibleState:= <0>
UIA_LegacyIAccessibleDefaultAction:= <click ancestor>
UIA_IsDataValidForForm:= <False>
UIA_ProviderDescription:= <[pid:7016,providerId:0x0 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]>
UIA_IsItemContainerPatternAvailable:= <False>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <False>

 

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...