Jump to content
Sign in to follow this  
232showtime

UI Automation Help

Recommended Posts

232showtime

Good  day, its my first time creating script using UIA Wrappers. im kinda confused:

#include "UIAWrappers.au3"

$FrmClassName="TFrmMain"
$Button1="Add"  ;script is clicking all the button, if I use all the button name in this control->[CLASS:TBitBtn; INSTANCE:12]

$Form=_UIA_getFirstObjectOfElement($UIA_oDesktop,"class:=" & $FrmClassName, $treescope_children)

if isobj($Form) Then

    $Button2=_UIA_getFirstObjectOfElement($Form,"name:=" & $Button1, $treescope_subtree)
    $oInvokeP=_UIA_getpattern($Button2,$UIA_InvokePatternID)
    $oInvokeP.Invoke
EndIf

 

but if I use the option name in [CLASS:TActionMainMenuBar; INSTANCE:1] it doesn't click any option in menu bar like "File", "View" or "Edit" and got error mesage

 

#include "UIAWrappers.au3"

$FrmClassName="TFrmMain"
$Button1="File" ;doesnt click File, View or edit in menubar 

$Form=_UIA_getFirstObjectOfElement($UIA_oDesktop,"class:=" & $FrmClassName, $treescope_children)

if isobj($Form) Then


    $Button2=_UIA_getFirstObjectOfElement($Form,"name:=" & $Button1, $treescope_subtree)
    $oInvokeP=_UIA_getpattern($Button2,$UIA_InvokePatternID)
    $oInvokeP.Invoke

EndIf 

;got error
"C:\Program Files (x86)\AutoIt3\Include\UIAWrappers.au3" (514) : ==> Variable must be of type "Object".:
$obj.getCurrentPattern($patternID, $pPattern)
$obj^ ERROR

->09:03:47 AutoIt3.exe ended.rc:1
+>09:03:47 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 1.383

 

 

 

 

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • toto22
      By toto22
      I'm working on a script that does Auto-Log in for me. it looks like this :
      #include "UIAWrappers.au3" If ProcessExists("Advanced Dashboard.exe") Then Else Run("C:\Program Files (x86)\Advanced Dashboard\Advanced Dashboard.exe") EndIf sleep(1000) Local $oP6=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Advanced Dashboard", $treescope_children) Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.34f5582_r9_ad1", $treescope_children) Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Shell Embedding", $treescope_children) Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Shell DocObject View", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "controltype:=UIA_PaneControlTypeId;class:=Internet Explorer_Server", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=WebBroker Login;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children) Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oUIElement1=_UIA_getObjectByFindAll($oP0, "title:=Password;ControlType:=UIA_EditControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement1,"click") Send("*****") Local $oUIElement2=_UIA_getObjectByFindAll($oP0, "title:=Login;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement2,"click") Is there a way to check if "$oUIElement1" exists before I enter my password?
      I want my script to wait for "$oUIElement1" object to be present in-order to to do a log-in and do not rely on Sleep(1000). Thank you in advance!
    • muchado
      By muchado
      I have found AutoIT to be very useful in automating some of the older programs that we use, but I am now trying to work out how to automate newer programs that use the Windows Forms - such as WindowsForms10.Window.8.app.0.2bf8098_r13_ad1
      I have read through the manual, but do not find anything on this there. I have also done some reading on the forum and have found material that looks useful, but I am not familiar with this and some of the threads look a little old. Please could someone update me on what the latest status is on this?
      Are there any plans to provide wrappers to the UI Automation controls, similar to those already provided for ListView, ComboBox, etc? How would I go about making a menu selection with such a system? If people are not using AutoIT for this kind of automation, then what are they using instead? Similar threads:
      '?do=embed' frameborder='0' data-embedContent>> - 2011 '?do=embed' frameborder='0' data-embedContent>> - 2008 '?do=embed' frameborder='0' data-embedContent>> - 2012 Other questions if you have time...
      What is the difference between MSAA mode and UI Automation? If I am using "Inspect.exe", how do I identify what information that I need to send a command to the control? Sorry - lots of questions - I am very much finding my way around this.
       
×