milkmoron Posted August 6, 2018 Posted August 6, 2018 (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 August 6, 2018 by milkmoron
junkew Posted August 13, 2018 Posted August 13, 2018 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. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now