Jump to content

Recommended Posts

Posted (edited)

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.

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
×
×
  • Create New...