Jump to content

Recommended Posts

Posted (edited)

I am trying to automate a program that attaches files. I have the following code.

_UIA_setVar("row1attachment","Title:=(Value=(.*)# Row=1 Column=File Name);controltype:=UIA_TextControlTypeId")
local $orow1attachment=_UIA_getObject("title:=Value=(.*)# Row=1 Column=File Name;ControlType:=UIA_TextControlTypeId")

If IsObj($orow1attachment) Then

   _UIA_setVar("View Activity","Title:=View Activity;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app.0.30495d1_r9_ad1") ;View Activity

   _UIA_Action("View Activity","highlight")
   _UIA_Action("View Activity","setfocus")

WinActivate ( "View Activity" , "" )

   _UIA_action("row1attachment","highlight")
   _UIA_action("row1attachment","click")

   local $AttachmentsAmount = 2

_UIA_setVar("row2attachment","Title:=(Value=(.*)# Row=2 Column=File Name);controltype:=UIA_TextControlTypeId")
local $orow2attachment=_UIA_getObject("title:=Value=(.*)# Row=2 Column=File Name;ControlType:=UIA_TextControlTypeId")

The only problem is when if finally encounters a attachment that doesn't exist it takes a long time to process. Is there a more efficient way to see if an object exists and then move on to the next step?

Edited by milkmoron
Posted

Yes, you allways can use the uia interfaces. The wrapper keeps searching in different hierarchies and in worst case tries to find from desktop. Find the parent thru the wrapper and the use findall function. Examples of usage in the wrapper and somewhere in examples 1 thru 10 these interfaces are shown on how to work in comparison to winlist.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...