Jump to content
nooneclose

[SOLVED] Why does my UIA code break after the first iteration? - (Moved)

Recommended Posts

Posted (edited)

Good morning, all. I am having a very hard time figuring out why my code "breaks" every second (and every time after) iteration in the loop. 

I am trying to automate the process of filling out a form for work. I need to find and send data to seven fields and get data from one field. 

Here are a couple of pictures of the fields I am interacting with. The fields are on the same forum/page. (the green boxed ones)

 

829096499_Screenshot(16).thumb.png.0f0de48ec8ce6b591460e7dedd767650.png

1392017443_Screenshot(17).thumb.png.16eece76c0082c9484518ab8c34499ae.png

Here is my code so far. 

 

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
                                                                        ;Allows for the combining of UDFs by disabling error messages. (I get error messages for "problems" that dont actually exsist)
#include <AD.au3>                                                       ;Allows Active Directory functions
#include <Array.au3>                                                    ;Allows special Array functions
#include <Constants.au3>                                                ;Allows constants to be used
#include <Date.au3>                                                     ;Allows Date and Time functions
#include <DateTimeConstants.au3>                                        ;Allows Date and Time constant functions
#include "DTC.au3"                                                      ;Allows Custom Date and Time functions
#include <IE.au3>                                                       ;Allows Internet Explorer functions
#include <Misc.au3>                                                     ;Allows the "is pressed" function to be used
#include <MsgBoxConstants.au3>                                          ;Allows Message box function to be used
#include <OutlookEX.au3>                                                ;Allows the Outlook functions
#include <String.au3>                                                   ;Allows special string functions
#include <StringConstants.au3>                                          ;Allows String constant functions
#include <Timers.au3>                                                   ;Allows timer functions
;#RequireAdmin                                                          ;Requests admin privliges before starting program

; Special UDFs for UIA automation
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <debug.au3>
#include <WinAPI.au3>
#include "UIAWrappers.au3"

#AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os


;*******************************************************************************
; Format and send the vaild E-mail's contents
;*******************************************************************************
Func SendEmailData()

    ConsoleWrite("Action 16: Send E-mail Data to it's proper fields" & " at line: " & @ScriptLineNumber & @CRLF)


        ;===============================================================================
        ; Store the Elements
        ;===============================================================================
        ; Description
        _UIA_setVar("oDescription","Title:=Description:;controltype:=UIA_EditControlTypeId;class:=")

        ; Long Description OK Button
        _UIA_setVar("oLongButton","Title:=Long Description;controltype:=UIA_ImageControlTypeId;class:=")
        _UIA_setVar("oLongOk","Title:=OK;controltype:=UIA_ButtonControlTypeId;class:=")

        ; Work Order Number
        _UIA_setVar("oWorkOrderNum","Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=")

        ; Location
        _UIA_setVar("oLocation","Title:=Location:;controltype:=UIA_EditControlTypeId;class:=")

        ; Work Type
        _UIA_setVar("oWorkType","Title:=Work Type:;controltype:=UIA_EditControlTypeId;class:=")

        ; Reported By Date
        _UIA_setVar("oDate","Title:=Reported Date:;controltype:=UIA_EditControlTypeId;class:=")

        ; Reported By Person
        _UIA_setVar("oCustomer","Title:=Reported By:;controltype:=UIA_EditControlTypeId;class:=")

        ; Reported By Email
        _UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=UIA_EditControlTypeId;class:=")

        ; Reported By Phone
        _UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=UIA_EditControlTypeId;class:=")


    Local $WorkType = "CM"

    ; Send the stored data to the proper field
    Local $stringSplitter = ", "
    Local $conCateStrings = $eDescription & $stringSplitter & $eComments
    Local $ComStringLen   = StringLen($eComments)
    Local $TrimedDesc     = StringTrimLeft($eDescription, 1)

    ;===============================================================================
    ; Check to see if the Description and the Long Description can be concatenated
    If StringLen($conCateStrings) <= 100 Then
        Sleep(2000)
        _UIA_action("oDescription","highlight")
        Sleep(300)
        _UIA_Action("oDescription","setfocus")
        Sleep(300)
        _UIA_action("oDescription","click")
        Sleep(500)
        _UIA_action("oDescription", "setvalue", $conCateStrings)
        _UIA_action("oDescription","highlight")

        ; Wipes the long description so no duplication happens
        $eComments = ""

    ;===============================================================================
    ; Send the Long Description in place of the Description
    ElseIf $TrimedDesc = "Other" AND $ComStringLen <= 100 Then
        Sleep(2000)
        _UIA_action("oDescription","highlight")
        Sleep(300)
        _UIA_Action("oDescription","setfocus")
        Sleep(300)
        _UIA_action("oDescription","click")
        Sleep(500)
        _UIA_action("oDescription", "setvalue", $eComments)
        _UIA_action("oDescription","highlight")
        Sleep(2000)

    ;===============================================================================
    ; Send the Long Description in place of the Description and Send the rest of it to the Long Description field
    ElseIf $TrimedDesc = "Other" AND $ComStringLen >= 100 Then

        SplitLongDesc()

        ; Description gets the first 100 Characters
        $eDescription = $FirstLine

        ; Long Description gets the rest
        $eComments = StringMid($sNewString, 101)

        Sleep(2000)
        _UIA_action("oDescription","highlight")
        Sleep(500)
        _UIA_Action("oDescription","setfocus")
        Sleep(500)
        _UIA_action("oDescription","click")
        Sleep(500)
        _UIA_action("oDescription", "setvalue", $eDescription)
        _UIA_action("oDescription","highlight")
        Sleep(2000)

    ;===============================================================================
    ; Send the Description and some of the Long Description
    ElseIf StringLen($eDescription) <= 80 AND $eComments <> "" Then

        SplitLongDesc()

        ; Description gets the first 100 Characters
        $eDescription = $FirstLine

        ; Long Description gets the rest
        $eComments = StringMid($sNewString, 101)

        Sleep(2000)
        _UIA_action("oDescription","highlight")
        Sleep(300)
        _UIA_Action("oDescription","setfocus")
        Sleep(300)
        _UIA_action("oDescription","click")
        Sleep(500)
        _UIA_action("oDescription", "setvalue", $eDescription)
        _UIA_action("oDescription","highlight")
        Sleep(2000)

    ;===============================================================================
    ; Send the original Description
    Else
        Sleep(2000)
        _UIA_action("oDescription","highlight")
        Sleep(300)
        _UIA_Action("oDescription","setfocus")
        Sleep(300)
        _UIA_action("oDescription","click")
        Sleep(500)
        _UIA_action("oDescription", "setvalue", $eDescription)
        _UIA_action("oDescription","highlight")
        Sleep(2000)
    EndIf

    ;===============================================================================
    ; Click the long description button
    Sleep(2000)
    _UIA_action("oLongButton","highlight")
    Sleep(300)
    _UIA_Action("oLongButton","setfocus")
    Sleep(300)
    _UIA_action("oLongButton", "click")
    _UIA_action("oLongButton", "highlight")
    _UIA_action("oLongButton", "click")
    Sleep(2000)

    ;===============================================================================
    ; Send the long description
    Sleep(1000)

    if StringLen($eComments) >= 250 Then
        Sleep(500)

        Send($eComments)

        Sleep(10000)
    ElseIf StringLen($eComments) >= 150 Then
        Sleep(500)

        Send($eComments)

        Sleep(6000)
    ElseIf StringLen($eComments) <= 10 Then
        Sleep(500)

        Send($eComments)

        Sleep(1500)
    Else
        Sleep(500)

        Send($eComments)

        Sleep(4000)
    EndIf

    ;===============================================================================
    ; Click the ok button
    Sleep(2000)
    _UIA_action("oLongOk","highlight")
    Sleep(300)
    _UIA_Action("oLongOk","setfocus")
    Sleep(300)
    _UIA_action("oLongOk", "click")
    _UIA_action("oLongOk", "highlight")
    Sleep(2000)

    ;===============================================================================
    ; The work order number
    _UIA_action("oWorkOrderNum","highlight")
    Sleep(300)
    _UIA_Action("oWorkOrderNum","setfocus")
    Sleep(300)
    _UIA_action("oWorkOrderNum", "getvalue", $WoNum)
    _UIA_action("oWorkOrderNum","highlight")
    ;MsgBox("", "Work order number", $WoNum[2])

    ;===============================================================================
    ; The Location field
    Sleep(2000)
    _UIA_action("oLocation","highlight")
    Sleep(300)
    _UIA_Action("oLocation","setfocus")
    Sleep(300)
    _UIA_action("oLocation", "setvalue", $eLocation)
    _UIA_action("oLocation","highlight")

    ;===============================================================================
    ; The Work Type field
    Sleep(2000)
    _UIA_action("oWorkType","highlight")
    Sleep(300)
    _UIA_Action("oWorkType","setfocus")
    Sleep(300)
    _UIA_action("oWorkType", "setvalue", $WorkType)
    _UIA_action("oWorkType","highlight")

    ;===============================================================================
    ; The Reported By Date
    Sleep(2000)
    _UIA_action("oDate","highlight")
    Sleep(300)
    _UIA_Action("oDate","setfocus")
    Sleep(300)
    _UIA_action("oDate", "setvalue", $eSentOn)
    _UIA_action("oDate","highlight")

    ;===============================================================================
    ; The Requested by field
    Sleep(2000)
    _UIA_action("oCustomer","highlight")
    Sleep(300)
    _UIA_Action("oCustomer","setfocus")
    Sleep(300)
    _UIA_action("oCustomer", "setvalue", $eReportedBy)
    _UIA_action("oCustomer","highlight")

    ;===============================================================================
    ; The Requested by E-mail
    Sleep(2000)
    _UIA_action("oEmail","highlight")
    Sleep(300)
    _UIA_Action("oEmail","setfocus")
    Sleep(300)
    _UIA_action("oEmail", "setvalue", $eSenderAddress)
    _UIA_action("oEmail","highlight")

    ;===============================================================================
    ; The Requested by Phone
    Sleep(2000)
    _UIA_action("oPhone","highlight")
    Sleep(300)
    _UIA_Action("oPhone","setfocus")
    Sleep(300)
    _UIA_action("oPhone", "setvalue", $eRoomPhone)
    _UIA_action("oPhone","highlight")


    MouseClick("left", 1843, 437, 2)
    Sleep(1500)
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Sleep(1000)
    MouseClick("left", 591, 279, 2)
    Sleep(3000)

    $lCount += 1

    ConsoleWrite("Action 16: Finished" & " at line: " & @ScriptLineNumber & @CRLF)
    Sleep(2000)

EndFunc

 

That is not all the code but that is the function that keeps "breaking" and by "breaking" I mean the program acts like it doesn't know where the description field is after the first iteration.

My code will just click somewhere in the far top left corner and somehow shrink the browser in the process of finding the description field.  

 

The code works perfectly the first iteration but after that, it "breaks" (doesn't know where to click/send data to). 

As always any help is greatly appreciated. 

 

NOTE: By the time 'Action 16' runs Chrome has already been opened and has navigated to the proper webpage.  I am trying to loop 'Action 16' multiple times. I do not leave that webpage while looping. 

Edited by nooneclose

Share this post


Link to post
Share on other sites

I have tried so many things to get this code to work. I tried running only the loop. I tried refreshing the webpage between loops. I tried using stored values. I tried breaking it down to only loop 2 values. I tried to re-fetch the Chrome info between loops. Nothing I do is making it possible to loop my UIA code, Why? Is UIA not compatible with loops?

Share this post


Link to post
Share on other sites

Moved to the appropriate forum.

Moderation Team


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Which error do you get?

The code only contains a function which is never called. 😨


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

This could be due to caching in the wrapper routines. The array used internally add rti. Prefixed items when object is found. However this fails when you refresh a page. I will chech if i made a function to remove rti. Item from the runtime array.

Share this post


Link to post
Share on other sites

@Xenobiologist and @junkew thank you very much for getting back with me. I was able to get it to loop but after the first go around it sends the first three data values to the same wrong field.

@Melba23 Sorry about the wrong forum. I didn't know where this kind of question belonged.

Here is my code:

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
                                                                        ;Allows for the combining of UDFs by disabling error messages. (I get error messages for "problems" that dont actually exsist)
#include <AD.au3>                                                       ;Allows Active Directory functions
#include <Array.au3>                                                    ;Allows special Array functions
#include <Constants.au3>                                                ;Allows constants to be used
#include <Date.au3>                                                     ;Allows Date and Time functions
#include <DateTimeConstants.au3>                                        ;Allows Date and Time constant functions
#include "DTC.au3"                                                      ;Allows Custom Date and Time functions
#include <IE.au3>                                                       ;Allows Internet Explorer functions
#include <Misc.au3>                                                     ;Allows the "is pressed" function to be used
#include <MsgBoxConstants.au3>                                          ;Allows Message box function to be used
#include <OutlookEX.au3>                                                ;Allows the Outlook functions
#include <String.au3>                                                   ;Allows special string functions
#include <StringConstants.au3>                                          ;Allows String constant functions
#include <Timers.au3>                                                   ;Allows timer functions
;#RequireAdmin                                                          ;Requests admin privliges before starting program

; Special UDFs for UIA automation
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <debug.au3>
#include <WinAPI.au3>
#include "UIAWrappers.au3"

#AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os



;*******************************************************************************
; Close the script if "End" is pressed
;*******************************************************************************
Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

HotKeySet("{END}", "Terminate")
Func Terminate()
    MsgBox($MB_ICONINFORMATION, "DEATH", "Help Desk Bot Stoped!", 5)
    Exit
EndFunc



;*******************************************************************************
; Global Variables
;*******************************************************************************
Global $t                 = ""
Global $oChrome           = ""
Global $oChromeToolbar    = ""
Global $oChromeAddressBar = ""
Global $oDocument         = ""

Global Const $cAddressBarByName = "name:=Adres- en zoekbalk"
Global Const $cChromeNewTabByName = "name:=Nieuw tabblad"
Global Const $cDocument ="controltype:=Document"

Global $lCount           = 0

; Global variables from the WO_AI
Global $count            = 0
Global $statusHasChanged = 0
Global $breakTheLoop     = 0
Global $numberOfUnRead   = 3
Global $sNewString       = ""
Global $FirstLine        = ""
Global $aFolder          = ""
Global $aItems           = ""
Global $WoNum            = ""
Global $oOutlook         = ""

Global $oItem            = ""                           ; Retrieve the item's object
Global $eBody            = ""                           ; The Body of the E-mail
Global $eSenderAddress   = "pPerson@hotmail.com"        ; Customers E-mail address
Global $eSentOn          = "8/13/19 7:36 AM"            ; When was the E-mail sent?
Global $eSubject         = ""                           ; Subject of the E-mail

Global $eDescription     = "The light bulb in the room 212 is out. I think the janitor hit it with a brick"
                                                        ; E-mail's Description
Global $eComments        = "Help its dark in here and i hear laughter!"
                                                        ; E-mail's Long Description
Global $eLocation        = "main"                       ; E-mail's Location
Global $eReportedBy      = "Leroy Jakins"               ; E-mail's Reported by
Global $eRoomPhone       = "4321"                       ; E-mail's Room Location




;*******************************************************************************
; Main functions of the program
;*******************************************************************************
While 1
    SendEmailData()
WEnd


;*******************************************************************************
; Format and send the vaild E-mail's contents
;*******************************************************************************
Func SendEmailData()

    MsgBox("", "reset", "start", 2)
    Sleep(3200)
    ConsoleWrite("Action 16: Send E-mail Data to it's proper fields" & " at line: " & @ScriptLineNumber & @CRLF)

    ; Work Order Number
    Local $1 = "o" + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) _
    + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90))

    Local $4 = "o" + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) _
    + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90))

    ;===============================================================================
    ; Store the Elements
    ;===============================================================================

    ; Work Order Number
    _UIA_setVar($1,"Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    ; Location
    _UIA_setVar("oLocation","Title:=Location:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    ; Work Type
    _UIA_setVar("oWorkType","Title:=Work Type:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    ; Reported By Date
    _UIA_setVar($4,"Title:=Reported Date:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    ; Reported By Person
    _UIA_setVar("oCustomer","Title:=Reported By:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    ; Reported By Email
    _UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    ; Reported By Phone
    _UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(500)

    Local $WorkType = "CM"

    ;===============================================================================
    ; The work order number
    _UIA_action($1,"highlight")
    Sleep(300)
    _UIA_Action($1,"setfocus")
    Sleep(300)
    _UIA_action($1, "getvalue", $WoNum)
    _UIA_action($1,"highlight")

    ConsoleWrite("Was I called?: Work Order Number " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Location field
    Sleep(2000)
    _UIA_action("oLocation","highlight")
    Sleep(300)
    _UIA_Action("oLocation","setfocus")
    Sleep(300)
    _UIA_action("oLocation", "setvalue", $eLocation)
    _UIA_action("oLocation","highlight")

    ConsoleWrite("Was I called?: Location " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Work Type field
    Sleep(2000)
    _UIA_action("oWorkType","highlight")
    Sleep(300)
    _UIA_Action("oWorkType","setfocus")
    Sleep(300)
    _UIA_action("oWorkType", "setvalue", $WorkType)
    _UIA_action("oWorkType","highlight")

    ;===============================================================================
    ; The Reported By Date
    Sleep(2000)
    _UIA_action($4,"highlight")
    Sleep(300)
    _UIA_Action($4,"setfocus")
    Sleep(300)
    _UIA_action($4, "setvalue", $eSentOn)
    _UIA_action($4,"highlight")

    ConsoleWrite("Was I called?: Reported By Date " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by Person
    Sleep(2000)
    _UIA_action("oCustomer","highlight")
    Sleep(300)
    _UIA_Action("oCustomer","setfocus")
    Sleep(300)
    _UIA_action("oCustomer", "setvalue", $eReportedBy)
    _UIA_action("oCustomer","highlight")

    ConsoleWrite("Was I called?: Reported By Person " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by E-mail
    Sleep(2000)
    _UIA_action("oEmail","highlight")
    Sleep(300)
    _UIA_Action("oEmail","setfocus")
    Sleep(300)
    _UIA_action("oEmail", "setvalue", $eSenderAddress)
    _UIA_action("oEmail","highlight")

    ConsoleWrite("Was I called?: Reported By Email " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by Phone
    Sleep(2000)
    _UIA_action("oPhone","highlight")
    Sleep(300)
    _UIA_Action("oPhone","setfocus")
    Sleep(300)
    _UIA_action("oPhone", "setvalue", $eRoomPhone)
    _UIA_action("oPhone","highlight")

    ConsoleWrite("Was I called?: Reported By Phone " & " at line: " & @ScriptLineNumber & @CRLF)

    Sleep(3000)
    MouseClick("left", 1843, 437, 2)
    Sleep(1500)
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Sleep(1000)
    MouseClick("left", 1748, 501, 1)
    Sleep(3000)
    MouseClick("left", 452, 277, 1)
    Sleep(3000)

    $lCount += 1

    ConsoleWrite("Action 16: Finished" & " at line: " & @ScriptLineNumber & @CRLF)
    MsgBox("", "reset", "reset", 2)
    Sleep(10000)

EndFunc

For some reason, I have to run the code twice for it to start working. The first time I think it stores the elements or something because it finishes (exits) before the second console write is executed. 

I did some tests while giving the work number (first value) a random name it would always skip the first one but everything else after would work almost every time.  

Am I being thorough enough in my explanations? 

Share this post


Link to post
Share on other sites

What happens when your script "exits" before the second consolewrite? Is there an error message in scite?


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

@Xenobiologist This is the message I get when the code crashes the first run. 

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Action 16: Send E-mail Data to it's proper fields at line: 102
+>10:17:52 AutoIt3.exe ended.rc:0
+>10:17:52 AutoIt3Wrapper Finished.
>Lua: Scintilla failure 1 for message 2152.
>Exit code: 0    Time: 11.79

Here is a video of the code running. You can see during the second iteration of the loop (after the reset message) that it does get and send the first two values but then it just "breaks" until the reset message pops up again. Also, I didn't record the part where I had to run the code twice. The video is me running the same code the second time with the same Chrome window open.

 

NOTE: I think the part of the video where the last "Reset" message appeared got cut on accident.

 

Share this post


Link to post
Share on other sites

Some more details on what the wrapper is doing

;~ Check if its maybe already in the repository with an RTI (Runtime Type Information) object reference
        $oElement = _UIA_getVar($cRTI_Prefix & StringUpper($obj_or_string))
        $bInRepo=@error=0 ? True : False
;~ If not found in repository try again without prefix (normally then a physical description and not an object)
        If $bInRepo = false Then
            $oElement = _UIA_getVar($obj_or_string)
            $bInRepo=@error=0 ? True : False
        EndIf

put this function in as a workaround to "reset" run time information by deleting it from the internal array. I have to test a little more as I am not 100% sure if the other internal used RTI.lastelement and some other are rebuild automatically when needed.

func _UIAResetRTIVars()
    for $i=(ubound($uia_vars, 1)-1) to 0 step -1
        if stringleft($uia_vars[$i][0],stringlen($cRTI_Prefix))=$cRTI_Prefix Then
            _ArrayDelete($UIA_Vars,$i)
        EndIf
    next
EndFunc

;~ example
_ArrayDisplay($UIA_Vars)
_UIAResetRTIVars()
_ArrayDisplay($UIA_Vars)

 

 

Share this post


Link to post
Share on other sites

@junkew I tried to implement the function you mentioned and I changed my code back to normal. (no random names) It ran great for the first iteration but it just quit during the second loop. Did I implement the function wrong? I added a call in the call section then the function definition at the bottom of the script.

Here is the code I used: 

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
                                                                        ;Allows for the combining of UDFs by disabling error messages. (I get error messages for "problems" that dont actually exsist)
#include <AD.au3>                                                       ;Allows Active Directory functions
#include <Array.au3>                                                    ;Allows special Array functions
#include <Constants.au3>                                                ;Allows constants to be used
#include <Date.au3>                                                     ;Allows Date and Time functions
#include <DateTimeConstants.au3>                                        ;Allows Date and Time constant functions
#include "DTC.au3"                                                      ;Allows Custom Date and Time functions
#include <IE.au3>                                                       ;Allows Internet Explorer functions
#include <Misc.au3>                                                     ;Allows the "is pressed" function to be used
#include <MsgBoxConstants.au3>                                          ;Allows Message box function to be used
#include <OutlookEX.au3>                                                ;Allows the Outlook functions
#include <String.au3>                                                   ;Allows special string functions
#include <StringConstants.au3>                                          ;Allows String constant functions
#include <Timers.au3>                                                   ;Allows timer functions
;#RequireAdmin                                                          ;Requests admin privliges before starting program

; Special UDFs for UIA automation
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <debug.au3>
#include <WinAPI.au3>
#include "UIAWrappers.au3"

#AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os



;*******************************************************************************
; Close the script if "End" is pressed
;*******************************************************************************
Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

HotKeySet("{END}", "Terminate")
Func Terminate()
    MsgBox($MB_ICONINFORMATION, "DEATH", "Help Desk Bot Stoped!", 5)
    Exit
EndFunc



;*******************************************************************************
; Global Variables
;*******************************************************************************
Global $t                 = ""
Global $oChrome           = ""
Global $oChromeToolbar    = ""
Global $oChromeAddressBar = ""
Global $oDocument         = ""

Global Const $cAddressBarByName = "name:=Adres- en zoekbalk"
Global Const $cChromeNewTabByName = "name:=Nieuw tabblad"
Global Const $cDocument ="controltype:=Document"

Global $lCount           = 0

; Global variables from the WO_AI
Global $count            = 0
Global $statusHasChanged = 0
Global $breakTheLoop     = 0
Global $numberOfUnRead   = 3
Global $sNewString       = ""
Global $FirstLine        = ""
Global $aFolder          = ""
Global $aItems           = ""
Global $WoNum            = ""
Global $oOutlook         = ""

Global $oItem            = ""                           ; Retrieve the item's object
Global $eBody            = ""                           ; The Body of the E-mail
Global $eSenderAddress   = "pPerson@hotmail.com"        ; Customers E-mail address
Global $eSentOn          = "8/13/19 7:36 AM"            ; When was the E-mail sent?
Global $eSubject         = ""                           ; Subject of the E-mail

Global $eDescription     = "The light bulb in the room 212 is out. I think the janitor hit it with a brick"
                                                        ; E-mail's Description
Global $eComments        = "Help its dark in here and i hear laughter!"
                                                        ; E-mail's Long Description
Global $eLocation        = "main"                       ; E-mail's Location
Global $eReportedBy      = "Leroy Jakins"               ; E-mail's Reported by
Global $eRoomPhone       = "4321"                       ; E-mail's Room Location




;*******************************************************************************
; Main functions of the program
;*******************************************************************************
While 1
    SendEmailData()

    UIAResetRTIVars()

WEnd


;*******************************************************************************
; Format and send the vaild E-mail's contents
;*******************************************************************************
Func SendEmailData()

    MsgBox("", "reset", "start", 2)
    Sleep(3200)
    ConsoleWrite("Action 16: Send E-mail Data to it's proper fields" & " at line: " & @ScriptLineNumber & @CRLF)

    ; Work Order Number
    ;Local $1 = "o" + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) _
    ;+ Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90)) + Chr(Random(65,90))


    ;===============================================================================
    ; Store the Elements
    ;===============================================================================
    ; Description
    _UIA_setVar("oDescription","Title:=Description:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Work Order Number
    _UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Location
    _UIA_setVar("oLocation","Title:=Location:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Work Type
    _UIA_setVar("oWorkType","Title:=Work Type:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Reported By Date
    _UIA_setVar("oDate","Title:=Reported Date:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Reported By Person
    _UIA_setVar("oCustomer","Title:=Reported By:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Reported By Email
    _UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    ; Reported By Phone
    _UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=UIA_EditControlTypeId;class:=")
    Sleep(300)

    Local $WorkType = "CM"

    ;===============================================================================
    ; Send the original Description
    Sleep(300)
    _UIA_action("oDescription","highlight")
    Sleep(300)
    _UIA_Action("oDescription","setfocus")
    Sleep(300)
    _UIA_action("oDescription","click")
    Sleep(500)
    _UIA_action("oDescription", "setvalue", $eDescription)
    _UIA_action("oDescription","highlight")
    Sleep(2000)

    ConsoleWrite("Was I called?: Description " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The work order number
    _UIA_action("oWorkOrder","highlight")
    Sleep(300)
    _UIA_Action("oWorkOrder","setfocus")
    Sleep(300)
    _UIA_action("oWorkOrder", "getvalue", $WoNum)
    _UIA_action("oWorkOrder","highlight")

    ConsoleWrite("Was I called?: Work Order Number " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Location field
    Sleep(2000)
    _UIA_action("oLocation","highlight")
    Sleep(300)
    _UIA_Action("oLocation","setfocus")
    Sleep(300)
    _UIA_action("oLocation", "setvalue", $eLocation)
    _UIA_action("oLocation","highlight")

    ConsoleWrite("Was I called?: Location " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Work Type field
    Sleep(2000)
    _UIA_action("oWorkType","highlight")
    ;_UIA_action($3,"highlight")
    Sleep(300)
    _UIA_Action("oWorkType","setfocus")
    ;_UIA_Action($3,"setfocus")
    Sleep(300)
    _UIA_action("oWorkType", "setvalue", $WorkType)
    ;_UIA_action($3, "setvalue", $WorkType)
    _UIA_action("oWorkType","highlight")
    ;_UIA_action($3,"highlight")

    ;===============================================================================
    ; The Reported By Date
    Sleep(2000)
    _UIA_action("oDate","highlight")
    Sleep(300)
    _UIA_Action("0Date","setfocus")
    Sleep(300)
    _UIA_action("oDate", "setvalue", $eSentOn)
    _UIA_action("oDate","highlight")

    ConsoleWrite("Was I called?: Reported By Date " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by Person
    Sleep(2000)
    _UIA_action("oCustomer","highlight")
    Sleep(300)
    _UIA_Action("oCustomer","setfocus")
    Sleep(300)
    _UIA_action("oCustomer", "setvalue", $eReportedBy)
    _UIA_action("oCustomer","highlight")

    ConsoleWrite("Was I called?: Reported By Person " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by E-mail
    Sleep(2000)
    _UIA_action("oEmail","highlight")
    Sleep(300)
    _UIA_Action("oEmail","setfocus")
    Sleep(300)
    _UIA_action("oEmail", "setvalue", $eSenderAddress)
    _UIA_action("oEmail","highlight")

    ConsoleWrite("Was I called?: Reported By Email " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by Phone
    Sleep(2000)
    _UIA_action("oPhone","highlight")
    Sleep(300)
    _UIA_Action("oPhone","setfocus")
    Sleep(300)
    _UIA_action("oPhone", "setvalue", $eRoomPhone)
    _UIA_action("oPhone","highlight")

    ConsoleWrite("Was I called?: Reported By Phone " & " at line: " & @ScriptLineNumber & @CRLF)

    Sleep(3000)
    MouseClick("left", 1843, 437, 2)
    Sleep(1500)
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Send("{UP}")
    Sleep(1000)
    MouseClick("left", 1748, 501, 1)
    Sleep(3000)
    MouseClick("left", 452, 277, 1)
    Sleep(3000)

    $lCount += 1

    ConsoleWrite("Action 16: Finished" & " at line: " & @ScriptLineNumber & @CRLF)
    Sleep(10000)

EndFunc

; Suggestion by Junkew the author of this UDF
Func UIAResetRTIVars()

    MsgBox("", "reset", "reset", 2)

    _ArrayDisplay($UIA_Vars)

    for $i=(ubound($uia_vars, 1)-1) to 0 step -1
        if stringleft($uia_vars[$i][0],stringlen($cRTI_Prefix))=$cRTI_Prefix Then
            _ArrayDelete($UIA_Vars,$i)
        EndIf
    next

    _ArrayDisplay($UIA_Vars)

    MsgBox("", "reset", "Finished", 2)

EndFunc

 

Here is the message I got when it just gave up:

Action 16: Send E-mail Data to it's proper fields at line: 105
Was I called?: Description  at line: 162
Was I called?: Work Order Number  at line: 173
Was I called?: Location  at line: 185
Was I called?: Reported By Date  at line: 211
>Lua: Scintilla failure 1 for message 2152.
Was I called?: Reported By Person  at line: 223
Was I called?: Reported By Email  at line: 235
Was I called?: Reported By Phone  at line: 247
Action 16: Finished at line: 294
Action 16: Send E-mail Data to it's proper fields at line: 105
+>13:42:29 AutoIt3.exe ended.rc:0
+>13:42:29 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 162.3

Here is the output from the _ArrayDisplays:

1st:

1195658380_Screenshot(18).png.799bf6b88303479b7e45863be77e7106.png

2nd:

598610491_Screenshot(19).png.758cbbe1b9df45b872959dd690de67ae.png

Did I do something wrong? I ran the code four times with the same result each time.

Also, thank you for taking the time to help me I greatly appreciate it.  

Share this post


Link to post
Share on other sites

I changed one thing and it worked ish. I only changed the $i in the _ArrayDelete to a high number (32) and it looped plus filled in every field, except one ("oLocation"), four times! :) we are getting close. 

Here is the code:

; Suggestion by Junkew the author of this UDF
Func UIAResetRTIVars()

    MsgBox("", "reset", "reset", 2)

    _ArrayDisplay($UIA_Vars)

    for $i=(ubound($uia_vars, 1)-1) to 0 step -1
        if stringleft($uia_vars[$i][0],stringlen($cRTI_Prefix))=$cRTI_Prefix Then
            ;_ArrayDelete($UIA_Vars,$i)
            _ArrayDelete($UIA_Vars,32)
        EndIf
    next

    _ArrayDisplay($UIA_Vars)

    MsgBox("", "reset", "Finished", 2)

EndFunc

 

Share this post


Link to post
Share on other sites
  • No it does exactly what it should do it removes the RTI.<name> items from  the internal array
    as you can see the array has your logical description for example like oworkOrder.
    When its found it adds another enrtry RTI.oWorkOrder which on screen looks empty in col1 but ac tually contains the physical object reference to the object.
    This is then reused on the same page when you do another action with same object.

Looking at your script

You should cleanup your script a little for example make a function like this and put it before the while loop. Its not needed to repeat this part and sleep is also not needed for _uia_setvar

func defineElements()
    ;===============================================================================
    ; Store the Elements
    ;===============================================================================
    ; Description
    _UIA_setVar("oDescription","Title:=Description:;controltype:=UIA_EditControlTypeId;class:=")

    ; Work Order Number
    _UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=")
 
    ; Location
    _UIA_setVar("oLocation","Title:=Location:;controltype:=UIA_EditControlTypeId;class:=")
 
    ; Work Type
    _UIA_setVar("oWorkType","Title:=Work Type:;controltype:=UIA_EditControlTypeId;class:=")
 
    ; Reported By Date
    _UIA_setVar("oDate","Title:=Reported Date:;controltype:=UIA_EditControlTypeId;class:=")
 
    ; Reported By Person
    _UIA_setVar("oCustomer","Title:=Reported By:;controltype:=UIA_EditControlTypeId;class:=")
 
    ; Reported By Email
    _UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=UIA_EditControlTypeId;class:=")
 
    ; Reported By Phone
    _UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=UIA_EditControlTypeId;class:=")
 ndfunc

 

Hard to say as in video it looks 2nd loop starts as it fills the first 2 fields. There should be a logfile xml telling you in detail what object its looking for an if object is found

Share this post


Link to post
Share on other sites

remove:    ;class:=      from all your descriptions in uia_setvar it doesnt add anything

write this: controltype:=UIA_EditControlTypeId as 

controltype:=Edit

although both will work it makes it a little easier to read

 

I miss somewhere in your coding

_UIA_Action($cDocument,"setfocus")

and not setting focus to chrome window.

Also not reason it doesnt work but it will give more speed if mainwindow is given.

Share this post


Link to post
Share on other sites
  • deleting allways same item 32 is not correct and I would be surprised if thats the cause
  • Send("{UP 32}") is shorter wayfor send 32 times an up key but also not causing your issue
  • Check in first round with simplespy the identification string for that objet
    check in 2nd round again with simplespy the identification string (it can be after a page save/refresh that descriptions are changing)
  • put output of simplespy for some elements in this thread
  • we could identify in a different way (could be harder to make as You have to guess a little on the indexrelative value)
    ; Work Order Number
    _UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=")
    ; Location
    _UIA_setVar("oLocation","Title:=Work Order:;indexrelative:=2")

  • similar for index but thats much harder as its only based on controltype
    ; Work Order Number
    _UIA_setVar("oWorkOrder","controltype:=Edit;index:=5")
    Sleep(300)

    ; Location
    _UIA_setVar("oLocation","controltype:=Edit;index:=6")
    Sleep(300)
  • check what the xml logfile is saying

Share this post


Link to post
Share on other sites

Here is the log I got. I changed/cleaned up the code like you suggested (Thank you for teaching me I have learned a lot) I changed the work type and location too. (I don't know how to find the "index numbers") I got the simply spy for the description field during the first and second run but the results are the same. 

Log: It didn't loop well this time

<?xml version="1.0" encoding="UTF-8"?>
<log space="preserve"><logline level="5" timestamp="20190813-152828827"> 
<information> Information _UIA_VersionInfo version: T0.7-0; Release date: 20190501; OS Version: WIN_10</information>
</logline>
</log>

Code:

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
                                                                        ;Allows for the combining of UDFs by disabling error messages. (I get error messages for "problems" that dont actually exsist)
#include <AD.au3>                                                       ;Allows Active Directory functions
#include <Array.au3>                                                    ;Allows special Array functions
#include <Constants.au3>                                                ;Allows constants to be used
#include <Date.au3>                                                     ;Allows Date and Time functions
#include <DateTimeConstants.au3>                                        ;Allows Date and Time constant functions
#include "DTC.au3"                                                      ;Allows Custom Date and Time functions
#include <IE.au3>                                                       ;Allows Internet Explorer functions
#include <Misc.au3>                                                     ;Allows the "is pressed" function to be used
#include <MsgBoxConstants.au3>                                          ;Allows Message box function to be used
#include <OutlookEX.au3>                                                ;Allows the Outlook functions
#include <String.au3>                                                   ;Allows special string functions
#include <StringConstants.au3>                                          ;Allows String constant functions
#include <Timers.au3>                                                   ;Allows timer functions
;#RequireAdmin                                                          ;Requests admin privliges before starting program

; Special UDFs for UIA automation
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <debug.au3>
#include <WinAPI.au3>
#include "UIAWrappers.au3"

#AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os



;*******************************************************************************
; Close the script if "End" is pressed
;*******************************************************************************
Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

HotKeySet("{END}", "Terminate")
Func Terminate()
    MsgBox($MB_ICONINFORMATION, "DEATH", "Help Desk Bot Stoped!", 5)
    Exit
EndFunc



;*******************************************************************************
; Global Variables
;*******************************************************************************
Global Const $cAddressBarByName = "name:=Adres- en zoekbalk"
Global Const $cChromeNewTabByName = "name:=Nieuw tabblad"
Global Const $cDocument ="controltype:=Document"

Global $WoNum            = ""
Global $eSenderAddress   = "pPerson@hotmail.com"        ; Customers E-mail address
Global $eSentOn          = "8/13/19 7:36 AM"            ; When was the E-mail sent?
Global $eSubject         = ""                           ; Subject of the E-mail
Global $eDescription     = "The light bulb in the room 212 is out. I think the janitor hit it with a brick"
                                                        ; E-mail's Description
Global $eComments        = "Help its dark in here and i hear laughter!"
                                                        ; E-mail's Long Description
Global $eLocation        = "main"                       ; E-mail's Location
Global $eReportedBy      = "Leroy Jakins"               ; E-mail's Reported by
Global $eRoomPhone       = "4321"                       ; E-mail's Room Location
Global $WorkType         = "CM"                         ; Work Type

;===============================================================================
; Store the Elements
;===============================================================================
; Description
_UIA_setVar("oDescription","Title:=Description:;controltype:=Edit;")

; Work Order Number
;_UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=Edit;")


 _UIA_setVar("oWorkOrder","controltype:=Edit;index:=5")
Sleep(300)


_UIA_setVar("oLocation","controltype:=Edit;index:=4")
Sleep(300)


; Location
;_UIA_setVar("oLocation","Title:=Location:;controltype:=Edit;")

; Work Type
_UIA_setVar("oWorkType","Title:=Work Type:;controltype:=Edit;")

; Reported By Date
_UIA_setVar("oDate","Title:=Reported Date:;controltype:=Edit;")

; Reported By Person
_UIA_setVar("oCustomer","Title:=Reported By:;controltype:=Edit;")

; Reported By Email
_UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=Edit;")

; Reported By Phone
_UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=Edit;")


;*******************************************************************************
; Main functions of the program
;*******************************************************************************
While 1
    SendEmailData()
    UIAResetRTIVars()
WEnd


;*******************************************************************************
; Format and send the vaild E-mail's contents
;*******************************************************************************
Func SendEmailData()

    MsgBox("", "reset", "start", 2)
    Sleep(3200)
    ConsoleWrite("Action 16: Send E-mail Data to it's proper fields" & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; Send the original Description
    Sleep(300)
    _UIA_action("oDescription","highlight")
    Sleep(300)
    _UIA_Action("oDescription","setfocus")
    Sleep(300)
    _UIA_action("oDescription","click")
    Sleep(500)
    _UIA_action("oDescription", "setvalue", $eDescription)
    _UIA_action("oDescription","highlight")
    Sleep(2000)

    ConsoleWrite("Was I called?: Description " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The work order number
    _UIA_action("oWorkOrder","highlight")
    Sleep(300)
    _UIA_Action("oWorkOrder","setfocus")
    Sleep(300)
    _UIA_action("oWorkOrder", "getvalue", $WoNum)
    _UIA_action("oWorkOrder","highlight")

    ConsoleWrite("Was I called?: Work Order Number " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Location field
    Sleep(2000)
    _UIA_action("oLocation","highlight")
    Sleep(300)
    _UIA_Action("oLocation","setfocus")
    Sleep(300)
    _UIA_action("oLocation", "setvalue", $eLocation)
    _UIA_action("oLocation","highlight")

    ConsoleWrite("Was I called?: Location " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Work Type field
    Sleep(2000)
    _UIA_action("oWorkType","highlight")
    ;_UIA_action($3,"highlight")
    Sleep(300)
    _UIA_Action("oWorkType","setfocus")
    ;_UIA_Action($3,"setfocus")
    Sleep(300)
    _UIA_action("oWorkType", "setvalue", $WorkType)
    ;_UIA_action($3, "setvalue", $WorkType)
    _UIA_action("oWorkType","highlight")
    ;_UIA_action($3,"highlight")

    ;===============================================================================
    ; The Reported By Date
    Sleep(2000)
    _UIA_action("oDate","highlight")
    Sleep(300)
    _UIA_Action("0Date","setfocus")
    Sleep(300)
    _UIA_action("oDate", "setvalue", $eSentOn)
    _UIA_action("oDate","highlight")

    ConsoleWrite("Was I called?: Reported By Date " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by Person
    Sleep(2000)
    _UIA_action("oCustomer","highlight")
    Sleep(300)
    _UIA_Action("oCustomer","setfocus")
    Sleep(300)
    _UIA_action("oCustomer", "setvalue", $eReportedBy)
    _UIA_action("oCustomer","highlight")

    ConsoleWrite("Was I called?: Reported By Person " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by E-mail
    Sleep(2000)
    _UIA_action("oEmail","highlight")
    Sleep(300)
    _UIA_Action("oEmail","setfocus")
    Sleep(300)
    _UIA_action("oEmail", "setvalue", $eSenderAddress)
    _UIA_action("oEmail","highlight")

    ConsoleWrite("Was I called?: Reported By Email " & " at line: " & @ScriptLineNumber & @CRLF)

    ;===============================================================================
    ; The Requested by Phone
    Sleep(2000)
    _UIA_action("oPhone","highlight")
    Sleep(300)
    _UIA_Action("oPhone","setfocus")
    Sleep(300)
    _UIA_action("oPhone", "setvalue", $eRoomPhone)
    _UIA_action("oPhone","highlight")

    ConsoleWrite("Was I called?: Reported By Phone " & " at line: " & @ScriptLineNumber & @CRLF)

    Sleep(3000)
    MouseClick("left", 1843, 437, 2)
    Sleep(1500)
    Send("{UP 32}")
    Sleep(1000)
    MouseClick("left", 1748, 501, 1)
    Sleep(3000)
    MouseClick("left", 452, 277, 1)
    Sleep(3000)

    ConsoleWrite("Action 16: Finished" & " at line: " & @ScriptLineNumber & @CRLF)
    Sleep(10000)

EndFunc

; Suggestion by Junkew the author of this UDF
Func UIAResetRTIVars()

    MsgBox("", "reset", "reset", 2)

    ;_ArrayDisplay($UIA_Vars)

    for $i=(ubound($uia_vars, 1)-1) to 0 step -1
        if stringleft($uia_vars[$i][0],stringlen($cRTI_Prefix))=$cRTI_Prefix Then
            ;_ArrayDelete($UIA_Vars,$i)
            _ArrayDelete($UIA_Vars,32)
        EndIf
    next

    ;_ArrayDisplay($UIA_Vars)

    MsgBox("", "reset", "Finished", 2)

EndFunc

Simply Spy: (1st Run)

At least we have an element title: [Description:] class: []

Having the following values for all properties: 
Title is: <Description:>    Class   := <>   controltype:= <UIA_EditControlTypeId>   ,<50004>    , (0000C354)    468;259;657;28
*** Parent Information top down ***
12: Title is: <Work Order Tracking - Google Chrome> Class   := <Chrome_WidgetWin_1> controltype:= <UIA_PaneControlTypeId>   ,<50033>    , (0000C371)    -8;-8;1936;1056
"Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1""  
11: Title is: <Work Order Tracking> Class   := <Chrome_RenderWidgetHostHWND>    controltype:= <UIA_DocumentControlTypeId>   ,<50030>    , (0000C36E)    0;71;1920;969
"Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND"" 
10: Title is: <  Work Order Tracking>   Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;71;1920;974
"Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=""    
9: Title is: <main form>    Class   := <>   controltype:= <UIA_GroupControlTypeId>  ,<50026>    , (0000C36A)    0;71;1920;974
"Title:=main form;controltype:=UIA_GroupControlTypeId;class:="" 
8: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;182;1920;863
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
7: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;182;1920;863
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
6: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;182;1920;859
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
5: Title is: <List View Work Order: Work Order: Description: Description: Long Description Location: Detail Menu Location description Long Description No image available No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility>   Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    294;182;1624;857
"Title:=List View Work Order: Work Order: Description: Description: Long Description Location: Detail Menu Location description Long Description No image available No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility;controltype:=UIA_CustomControlTypeId;class:=""   
4: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;1297;661
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
3: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;1297;657
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
2: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;869;59
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
1: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;869;55
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
0: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    468;235;694;55
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 


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

_UIA_setVar("oP1","Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1")    ;Work Order Tracking - Google Chrome
_UIA_setVar("oP2","Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND")   ;Work Order Tracking
_UIA_setVar("oP3","Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=")  ;  Work Order Tracking
_UIA_setVar("oP4","Title:=main form;controltype:=UIA_GroupControlTypeId;class:=")   ;main form
_UIA_setVar("oP5","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP6","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP7","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP8","Title:=List View Work Order: Work Order: Description: Description: Long Description Location: Detail Menu Location description Long Description No image available No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility;controltype:=UIA_CustomControlTypeId;class:=") ;List View Work Order: Work Order: Description: Description: Long Description Location: Detail Menu Location description Long Description No image available No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility
_UIA_setVar("oP9","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP10","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;
_UIA_setVar("oP11","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;
_UIA_setVar("oP12","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;
_UIA_setVar("oP13","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;

;~ $oUIElement=_UIA_getObjectByFindAll("Description:.mainwindow", "title:=Description:;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Description:;controltype:=UIA_EditControlTypeId;class:=") ;ControlType:=UIA_EditControlTypeId;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("oP8","highlight")
_UIA_Action("oP8","setfocus")
;~_UIA_Action("oP9","highlight")
_UIA_Action("oP9","setfocus")
;~_UIA_Action("oP10","highlight")
_UIA_Action("oP10","setfocus")
;~_UIA_Action("oP11","highlight")
_UIA_Action("oP11","setfocus")
;~_UIA_Action("oP12","highlight")
_UIA_Action("oP12","setfocus")
;~_UIA_Action("oP13","highlight")
_UIA_Action("oP13","setfocus")

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


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

Local $oP12=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children)  
_UIA_Action($oP12,"setfocus")
Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children) 
_UIA_Action($oP11,"setfocus")
Local $oP10=_UIA_getObjectByFindAll($oP11, "Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)    
Local $oP9=_UIA_getObjectByFindAll($oP10, "Title:=main form;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children)  
Local $oP8=_UIA_getObjectByFindAll($oP9, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)   
Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)   
Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)   
Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=List View Work Order: Work Order: Description: Description: Long Description Location: Detail Menu Location description Long Description No image available No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children) 
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:=;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("Description:.mainwindow", "title:=Description:;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Description:;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
;~_UIA_action($oUIElement,"highlight")
_UIA_action($oUIElement,"click")


*** Detailed properties of the highlighted element ***
UIA_title:= <Description:>
UIA_text:= <Description:>
UIA_regexptitle:= <Description:>
UIA_iaccessiblevalue:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
UIA_iaccessiblechildId:= <0>
UIA_id:= <m65d795a4-tb>
UIA_handle:= <0>
UIA_RuntimeId:= <42;2492026;4;-20406>
UIA_BoundingRectangle:= <468;259;657;28>
UIA_ProcessId:= <10972>
UIA_ControlType:= <50004>
UIA_LocalizedControlType:= <edit>
UIA_Name:= <Description:>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <True>
UIA_IsEnabled:= <True>
UIA_AutomationId:= <m65d795a4-tb>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <0>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_FrameworkId:= <Chrome>
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:= <True>
UIA_IsSelectionItemPatternAvailable:= <False>
UIA_IsSelectionPatternAvailable:= <False>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <True>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <True>
UIA_IsWindowPatternAvailable:= <False>
UIA_ValueValue:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
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:= <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:= <Description:>
UIA_LegacyIAccessibleValue:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
UIA_LegacyIAccessibleDescription:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
UIA_LegacyIAccessibleRole:= <42>
UIA_LegacyIAccessibleState:= <1048576>
UIA_LegacyIAccessibleDefaultAction:= <activate>
UIA_AriaRole:= <textbox>
UIA_IsDataValidForForm:= <True>
UIA_ProviderDescription:= <[pid:10972,providerId:0x0 Main(parent link):Microsoft: MSAA Proxy (IAccessible2) (unmanaged:uiautomationcore.dll)]>
UIA_IsItemContainerPatternAvailable:= <False>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <False>
UIA_OptimizeForVisualContent:= <False>
UIA_IsObjectModelPatternAvailable:= <False>
UIA_AnnotationAnnotationTypeId:= <60000>
UIA_IsAnnotationPatternAvailable:= <False>
UIA_IsTextPattern2Available:= <True>
UIA_StylesStyleId:= <0>
UIA_StylesFillColor:= <0>
UIA_StylesFillPatternColor:= <0>
UIA_IsStylesPatternAvailable:= <False>
UIA_IsSpreadsheetPatternAvailable:= <False>
UIA_IsSpreadsheetItemPatternAvailable:= <False>
UIA_Transform2CanZoom:= <False>
UIA_IsTransformPattern2Available:= <False>
UIA_LiveSetting:= <1>
UIA_IsTextChildPatternAvailable:= <True>
UIA_IsDragPatternAvailable:= <False>
UIA_DragIsGrabbed:= <False>
UIA_IsDropTargetPatternAvailable:= <False>
UIA_Transform2ZoomLevel:= <1>
UIA_Transform2ZoomMinimum:= <1>
UIA_Transform2ZoomMaximum:= <1>
UIA_IsTextEditPatternAvailable:= <True>
UIA_IsPeripheral:= <False>
UIA_IsCustomNavigationPatternAvailable:= <False>
UIA_PositionInSet:= <0>
UIA_SizeOfSet:= <0>
UIA_Level:= <0>
UIA_LandmarkType:= <0>
UIA_FillType:= <0>
UIA_VisualEffects:= <0>
UIA_IsSelectionPattern2Available:= <False>
UIA_Selection2ItemCount:= <0>
UIA_HeadingLevel:= <80050>
UIA_IsDialog:= <False>

Simply Spy: (2nd Run)

At least we have an element title: [Description:] class: []

Having the following values for all properties: 
Title is: <Description:>    Class   := <>   controltype:= <UIA_EditControlTypeId>   ,<50004>    , (0000C354)    468;259;657;28
*** Parent Information top down ***
12: Title is: <Work Order Tracking - Google Chrome> Class   := <Chrome_WidgetWin_1> controltype:= <UIA_PaneControlTypeId>   ,<50033>    , (0000C371)    -8;-8;1936;1056
"Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1""  
11: Title is: <Work Order Tracking> Class   := <Chrome_RenderWidgetHostHWND>    controltype:= <UIA_DocumentControlTypeId>   ,<50030>    , (0000C36E)    0;71;1920;969
"Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND"" 
10: Title is: <  Work Order Tracking>   Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;71;1920;974
"Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=""    
9: Title is: <main form>    Class   := <>   controltype:= <UIA_GroupControlTypeId>  ,<50026>    , (0000C36A)    0;71;1920;974
"Title:=main form;controltype:=UIA_GroupControlTypeId;class:="" 
8: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;182;1920;863
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
7: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;182;1920;863
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
6: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    0;182;1920;859
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
5: Title is: <List View Work Order: Work Order: Description: Description: Long Description Location: MAIN Detail Menu Location description Long Description Main Campus No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table Next Row [CTRL+Down Arrow] 1 - 2 of 2 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility>  Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    294;182;1624;857
"Title:=List View Work Order: Work Order: Description: Description: Long Description Location: MAIN Detail Menu Location description Long Description Main Campus No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table Next Row [CTRL+Down Arrow] 1 - 2 of 2 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility;controltype:=UIA_CustomControlTypeId;class:=""  
4: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;1297;661
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
3: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;1297;657
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
2: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;869;59
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
1: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    306;235;869;55
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 
0: Title is: <> Class   := <>   controltype:= <UIA_CustomControlTypeId> ,<50025>    , (0000C369)    468;235;694;55
"Title:=;controltype:=UIA_CustomControlTypeId;class:="" 


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

_UIA_setVar("oP1","Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1")    ;Work Order Tracking - Google Chrome
_UIA_setVar("oP2","Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND")   ;Work Order Tracking
_UIA_setVar("oP3","Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=")  ;  Work Order Tracking
_UIA_setVar("oP4","Title:=main form;controltype:=UIA_GroupControlTypeId;class:=")   ;main form
_UIA_setVar("oP5","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP6","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP7","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP8","Title:=List View Work Order: Work Order: Description: Description: Long Description Location: MAIN Detail Menu Location description Long Description Main Campus No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table Next Row [CTRL+Down Arrow] 1 - 2 of 2 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility;controltype:=UIA_CustomControlTypeId;class:=")    ;List View Work Order: Work Order: Description: Description: Long Description Location: MAIN Detail Menu Location description Long Description Main Campus No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table Next Row [CTRL+Down Arrow] 1 - 2 of 2 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility
_UIA_setVar("oP9","Title:=;controltype:=UIA_CustomControlTypeId;class:=")   ;
_UIA_setVar("oP10","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;
_UIA_setVar("oP11","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;
_UIA_setVar("oP12","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;
_UIA_setVar("oP13","Title:=;controltype:=UIA_CustomControlTypeId;class:=")  ;

;~ $oUIElement=_UIA_getObjectByFindAll("Description:.mainwindow", "title:=Description:;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Description:;controltype:=UIA_EditControlTypeId;class:=") ;ControlType:=UIA_EditControlTypeId;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("oP8","highlight")
_UIA_Action("oP8","setfocus")
;~_UIA_Action("oP9","highlight")
_UIA_Action("oP9","setfocus")
;~_UIA_Action("oP10","highlight")
_UIA_Action("oP10","setfocus")
;~_UIA_Action("oP11","highlight")
_UIA_Action("oP11","setfocus")
;~_UIA_Action("oP12","highlight")
_UIA_Action("oP12","setfocus")
;~_UIA_Action("oP13","highlight")
_UIA_Action("oP13","setfocus")

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


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

Local $oP12=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children)  
_UIA_Action($oP12,"setfocus")
Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children) 
_UIA_Action($oP11,"setfocus")
Local $oP10=_UIA_getObjectByFindAll($oP11, "Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)    
Local $oP9=_UIA_getObjectByFindAll($oP10, "Title:=main form;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children)  
Local $oP8=_UIA_getObjectByFindAll($oP9, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)   
Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)   
Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)   
Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=List View Work Order: Work Order: Description: Description: Long Description Location: MAIN Detail Menu Location description Long Description Main Campus No image available Asset: Detail Menu Asset description Long Description Parent WO: Detail Menu Parent WO description Long Description Classification: Classification: Detail Menu Class Description: Class Description: Select Value Site: Site: Class: Class: Work Type: Work Type: Select Value Origin: Origin: Select Value GL Account: GL Account: Select Value Failure Class: Failure Class: Detail Menu Problem Code: Problem Code: Select Value Storeroom Material Status: Storeroom Material Status: Detail Menu Direct Issue Material Status: Direct Issue Material Status: Detail Menu Work Package Material Status: Work Package Material Status: Detail Menu Material Status Last Updated: Material Status Last Updated: Update Material Status Attachments Attachments Status: Status: Status Date: Status Date: Inherit Status Changes? Inherit Status Changes: unchecked Accepts Charges? Accepts Charges: checked Is Task? Is Task: unchecked Under Flow Control? Under Flow Control: unchecked Suspend Flow Control? Suspend Flow Control: unchecked Flow Action: Flow Action: Detail Menu Flow Action Assist? Flow Action Assist: unchecked Attachments Open Filter CTRL+Z Filter Filter Table Next Row [CTRL+Down Arrow] 1 - 2 of 2 Download Hide Table: Attachments Attachments Attachments Table Button Group Job Details Minimize Job Details Section Job Details Asset Details Minimize Asset Details Section Asset Details Priority Minimize Priority Section Priority Address Information Maximize Address Information Section Multiple Assets,Locations and CIs Open Filter CTRL+Z Filter Filter Table 0 - 0 of 0 Download Show Table: Multiple Assets,Locations and CIs Scheduling Information Minimize Scheduling Information Section Scheduling Information Follow-up Work Minimize Follow-up Work Section Follow-up Work Responsibility Minimize Responsibility Section Responsibility;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)    
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:=;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("Description:.mainwindow", "title:=Description:;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Description:;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
;~_UIA_action($oUIElement,"highlight")
_UIA_action($oUIElement,"click")


*** Detailed properties of the highlighted element ***
UIA_title:= <Description:>
UIA_text:= <Description:>
UIA_regexptitle:= <Description:>
UIA_iaccessiblevalue:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
UIA_iaccessiblechildId:= <0>
UIA_id:= <m65d795a4-tb>
UIA_handle:= <0>
UIA_RuntimeId:= <42;2492026;4;-20406>
UIA_BoundingRectangle:= <468;259;657;28>
UIA_ProcessId:= <10972>
UIA_ControlType:= <50004>
UIA_LocalizedControlType:= <edit>
UIA_Name:= <Description:>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <True>
UIA_IsEnabled:= <True>
UIA_AutomationId:= <m65d795a4-tb>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <0>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_FrameworkId:= <Chrome>
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:= <True>
UIA_IsSelectionItemPatternAvailable:= <False>
UIA_IsSelectionPatternAvailable:= <False>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <True>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <True>
UIA_IsWindowPatternAvailable:= <False>
UIA_ValueValue:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
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:= <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:= <Description:>
UIA_LegacyIAccessibleValue:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
UIA_LegacyIAccessibleDescription:= <The light bulb in the room 212 is out. I think the janitor hit it with a brick>
UIA_LegacyIAccessibleRole:= <42>
UIA_LegacyIAccessibleState:= <1048576>
UIA_LegacyIAccessibleDefaultAction:= <activate>
UIA_AriaRole:= <textbox>
UIA_IsDataValidForForm:= <True>
UIA_ProviderDescription:= <[pid:10972,providerId:0x0 Main(parent link):Microsoft: MSAA Proxy (IAccessible2) (unmanaged:uiautomationcore.dll)]>
UIA_IsItemContainerPatternAvailable:= <False>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <False>
UIA_OptimizeForVisualContent:= <False>
UIA_IsObjectModelPatternAvailable:= <False>
UIA_AnnotationAnnotationTypeId:= <60000>
UIA_IsAnnotationPatternAvailable:= <False>
UIA_IsTextPattern2Available:= <True>
UIA_StylesStyleId:= <0>
UIA_StylesFillColor:= <0>
UIA_StylesFillPatternColor:= <0>
UIA_IsStylesPatternAvailable:= <False>
UIA_IsSpreadsheetPatternAvailable:= <False>
UIA_IsSpreadsheetItemPatternAvailable:= <False>
UIA_Transform2CanZoom:= <False>
UIA_IsTransformPattern2Available:= <False>
UIA_LiveSetting:= <1>
UIA_IsTextChildPatternAvailable:= <True>
UIA_IsDragPatternAvailable:= <False>
UIA_DragIsGrabbed:= <False>
UIA_IsDropTargetPatternAvailable:= <False>
UIA_Transform2ZoomLevel:= <1>
UIA_Transform2ZoomMinimum:= <1>
UIA_Transform2ZoomMaximum:= <1>
UIA_IsTextEditPatternAvailable:= <True>
UIA_IsPeripheral:= <False>
UIA_IsCustomNavigationPatternAvailable:= <False>
UIA_PositionInSet:= <0>
UIA_SizeOfSet:= <0>
UIA_Level:= <0>
UIA_LandmarkType:= <0>
UIA_FillType:= <0>
UIA_VisualEffects:= <0>
UIA_IsSelectionPattern2Available:= <False>
UIA_Selection2ItemCount:= <0>
UIA_HeadingLevel:= <80050>
UIA_IsDialog:= <False>

Where would I implement this _UIA_Action($cDocument,"setfocus") in my code as you suggested? 

Share this post


Link to post
Share on other sites
  • This treehierarchy tells you the order for cdocument but as it finds in round 1 and 2 workorder field it should not be the cause of your issue.

Below is the raw version for setting focus to the main window as simplespy gives. The $cDocument as used in examples has the shorter description

Local $oP12=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children)	
_UIA_Action($oP12,"setfocus")
Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children)	
_UIA_Action($oP11,"setfocus")

 

  • You should doublecheck that you have debug info logged (an empty logfile is weird)

Default is like below, just check you do not set it to false (do that only when it works stable)

    _UIA_setVar("Global.Debug", True)
    _UIA_setVar("Global.Debug.File", True)

  • Finding out index is hard and normally only doable when you can read the log quickly/fluently

The function 

_UIA_DumpThemAll($oP11, $treescope_subtree) will give you an indication on all objects that are searched but it could be hundreds/thousands to be carefull on what you dump to screen or file as it can be big.

  • you could thry 3 ways of setting value with 
_UIA_action("oLocation", "setvalue", $eLocation)
_UIA_action("oLocation", "setvalue using keys", $eLocation)
_UIA_action("oLocation", "setvalue using clipboard", $eLocation)

 

  • This is incorrect 32 should be $i, just check the arraydisplay before and after running
    _ArrayDelete($UIA_Vars,32)

All I can say is that things can work but most likely there is another field matching the description. Are you sure it works correct in first round and only fails in 2nd/3rd?

 

Share this post


Link to post
Share on other sites

@junkew I got great news and bad news. The great news is that it worked. It looped fine three times. The bad news is I still don't really know why it worked. 

Here is the code I used: (There is an empty function for testing later on. I need to send the fields different values each time it loops but I wanted it to loop perfectly first)

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
                                                                        ;Allows for the combining of UDFs by disabling error messages. (I get error messages for "problems" that dont actually exsist)
#include <AD.au3>                                                       ;Allows Active Directory functions
#include <Array.au3>                                                    ;Allows special Array functions
#include <Constants.au3>                                                ;Allows constants to be used
#include <Date.au3>                                                     ;Allows Date and Time functions
#include <DateTimeConstants.au3>                                        ;Allows Date and Time constant functions
#include "DTC.au3"                                                      ;Allows Custom Date and Time functions
#include <IE.au3>                                                       ;Allows Internet Explorer functions
#include <Misc.au3>                                                     ;Allows the "is pressed" function to be used
#include <MsgBoxConstants.au3>                                          ;Allows Message box function to be used
#include <OutlookEX.au3>                                                ;Allows the Outlook functions
#include <String.au3>                                                   ;Allows special string functions
#include <StringConstants.au3>                                          ;Allows String constant functions
#include <Timers.au3>                                                   ;Allows timer functions
;#RequireAdmin                                                          ;Requests admin privliges before starting program

; Special UDFs for UIA automation
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <debug.au3>
#include <WinAPI.au3>
#include "UIAWrappers.au3"

#AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os



;*******************************************************************************
; Close the script if "End" is pressed
;*******************************************************************************
Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

HotKeySet("{END}", "Terminate")
Func Terminate()
    MsgBox($MB_ICONINFORMATION, "DEATH", "Help Desk Bot Stoped!", 5)
    Exit
EndFunc



;*******************************************************************************
; Global Variables
;*******************************************************************************
Global Const $cAddressBarByName = "name:=Adres- en zoekbalk"
Global Const $cChromeNewTabByName = "name:=Nieuw tabblad"
Global Const $cDocument ="controltype:=Document"

Global $WoNum            = ""
Global $eSenderAddress   = "pPerson@hotmail.com"        ; Customers E-mail address
Global $eSentOn          = "8/13/19 7:36 AM"            ; When was the E-mail sent?
Global $eSubject         = ""                           ; Subject of the E-mail
Global $eDescription     = "The light bulb in the room 212 is out. I think the janitor hit it with a brick"
                                                        ; E-mail's Description
Global $eComments        = "Help its dark in here and i hear laughter!"
                                                        ; E-mail's Long Description
Global $eLocation        = "main"                       ; E-mail's Location
Global $eReportedBy      = "Leroy Jakins"               ; E-mail's Reported by
Global $eRoomPhone       = "4321"                       ; E-mail's Room Location
Global $WorkType         = "CM"                         ; Work Type

; DEBUG
_UIA_setVar("Global.Debug.File", True)
_UIA_setVar("Global.Debug", True)


;===============================================================================
; Store the Elements
;===============================================================================
; Description
;_UIA_setVar("oDescription","Title:=Description:;controltype:=Edit;")
_UIA_setVar("oDescription","controltype:=Edit;index:=4")

; Work Order Number
;_UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=Edit;")
 _UIA_setVar("oWorkOrder","controltype:=Edit;index:=3")

; Location
;_UIA_setVar("oLocation","Title:=Location:;controltype:=Edit;")
_UIA_setVar("oLocation","controltype:=Edit;index:=5")

; Work Type
_UIA_setVar("oWorkType","Title:=Work Type:;controltype:=Edit;")

; Reported By Date
_UIA_setVar("oDate","Title:=Reported Date:;controltype:=Edit;")

; Reported By Person
_UIA_setVar("oCustomer","Title:=Reported By:;controltype:=Edit;")

; Reported By Email
_UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=Edit;")

; Reported By Phone
_UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=Edit;")


;*******************************************************************************
; Main functions of the program
;*******************************************************************************
While 1
    SendEmailData()
    UIAResetRTIVars()
    ChangeValues()
WEnd


;*******************************************************************************
; Format and send the vaild E-mail's contents
;*******************************************************************************
Func SendEmailData()

    Local $oP12=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children)
    _UIA_Action($oP12,"setfocus")
    Sleep(300)
    Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children)
    _UIA_Action($oP11,"setfocus")

    MsgBox("", "reset", "start", 2)
    Sleep(3200)
    ConsoleWrite("Action 16: Send E-mail Data to it's proper fields" & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; Send the original Description
    Sleep(300)
    _UIA_action("oDescription","highlight")
    Sleep(300)
    ;_UIA_Action("oDescription","setfocus")
    Sleep(300)
    _UIA_action("oDescription","click")
    Sleep(500)
    _UIA_action("oDescription", "setvalue", $eDescription)
    _UIA_action("oDescription","highlight")
    Sleep(2000)

    ConsoleWrite("Was I called?: Description " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; The work order number
    _UIA_action("oWorkOrder","highlight")
    Sleep(300)
    ;_UIA_Action("oWorkOrder","setfocus")
    Sleep(300)
    _UIA_action("oWorkOrder", "getvalue", $WoNum)
    _UIA_action("oWorkOrder","highlight")

    ConsoleWrite("Was I called?: Work Order Number " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; The Location field
    Sleep(2000)
    _UIA_action("oLocation","highlight")
    Sleep(300)
    ;_UIA_Action("oLocation","setfocus")
    Sleep(300)
    _UIA_action("oLocation", "setvalue", $eLocation)
    _UIA_action("oLocation","highlight")

    ConsoleWrite("Was I called?: Location " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; The Work Type field
    Sleep(2000)
    _UIA_action("oWorkType","highlight")
    Sleep(300)
    ;_UIA_Action("oWorkType","setfocus")
    Sleep(300)
    _UIA_action("oWorkType", "setvalue", $WorkType)
    _UIA_action("oWorkType","highlight")

    ;===============================================================================
    ; The Reported By Date
    Sleep(2000)
    _UIA_action("oDate","highlight")
    Sleep(300)
    ;_UIA_Action("0Date","setfocus")
    Sleep(300)
    _UIA_action("oDate", "setvalue", $eSentOn)
    _UIA_action("oDate","highlight")

    ConsoleWrite("Was I called?: Reported By Date " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; The Requested by Person
    Sleep(2000)
    _UIA_action("oCustomer","highlight")
    Sleep(300)
    ;_UIA_Action("oCustomer","setfocus")
    Sleep(300)
    _UIA_action("oCustomer", "setvalue", $eReportedBy)
    _UIA_action("oCustomer","highlight")

    ConsoleWrite("Was I called?: Reported By Person " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; The Requested by E-mail
    Sleep(2000)
    _UIA_action("oEmail","highlight")
    Sleep(300)
    ;_UIA_Action("oEmail","setfocus")
    Sleep(300)
    _UIA_action("oEmail", "setvalue", $eSenderAddress)
    _UIA_action("oEmail","highlight")

    ConsoleWrite("Was I called?: Reported By Email " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    ;===============================================================================
    ; The Requested by Phone
    Sleep(2000)
    _UIA_action("oPhone","highlight")
    Sleep(300)
    ;_UIA_Action("oPhone","setfocus")
    Sleep(300)
    _UIA_action("oPhone", "setvalue", $eRoomPhone)
    _UIA_action("oPhone","highlight")

    ConsoleWrite("Was I called?: Reported By Phone " & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)

    Sleep(3000)
    MouseClick("left", 1843, 437, 2)
    Sleep(1500)
    Send("{UP 35}")
    Sleep(1000)
    MouseClick("left", 1748, 501, 1)
    Sleep(3000)
    MouseClick("left", 452, 277, 1)
    Sleep(3000)

    ConsoleWrite("Action 16: Finished" & " at line: " & @ScriptLineNumber & @CRLF & @CRLF)
    Sleep(4000)

EndFunc

; Suggestion by Junkew the author of the UIA UDF
Func UIAResetRTIVars()

    MsgBox("", "reset", "reset", 2)

    ;_ArrayDisplay($UIA_Vars)

    for $i=(ubound($uia_vars, 1)-1) to 0 step -1
        if stringleft($uia_vars[$i][0],stringlen($cRTI_Prefix))=$cRTI_Prefix Then
            _ArrayDelete($UIA_Vars,$i)
            ;_ArrayDelete($UIA_Vars,32)
        EndIf
    next

    ;_ArrayDisplay($UIA_Vars)

    MsgBox("", "reset", "Finished", 2)

EndFunc


Func ChangeValues()

Endfunc

Here is the log from it running:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\" /UserParams    
+>08:30:36 Starting AutoIt3Wrapper v.18.708.1148.0 SciTE v.4.1.0.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  params:-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Desktop\Bots\MyBotScripts\testing_Chrome_UIA_Loops.au3
+>08:30:37 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Action 16: Send E-mail Data to it's proper fields at line: 122

142434Was I called?: Description  at line: 137

1313131323Was I called?: Work Order Number  at line: 148

15151515253545Was I called?: Location  at line: 160

Was I called?: Reported By Date  at line: 182

Was I called?: Reported By Person  at line: 194

Was I called?: Reported By Email  at line: 206

Was I called?: Reported By Phone  at line: 218

Action 16: Finished at line: 230

Action 16: Send E-mail Data to it's proper fields at line: 122

142434Was I called?: Description  at line: 137

1313131323Was I called?: Work Order Number  at line: 148

15151515253545Was I called?: Location  at line: 160

Was I called?: Reported By Date  at line: 182

Was I called?: Reported By Person  at line: 194

Was I called?: Reported By Email  at line: 206

Was I called?: Reported By Phone  at line: 218

Action 16: Finished at line: 230

Action 16: Send E-mail Data to it's proper fields at line: 122

142434Was I called?: Description  at line: 137

1313131323Was I called?: Work Order Number  at line: 148

15151515253545Was I called?: Location  at line: 160

Was I called?: Reported By Date  at line: 182

Was I called?: Reported By Person  at line: 194

Was I called?: Reported By Email  at line: 206

Was I called?: Reported By Phone  at line: 218

Action 16: Finished at line: 230

+>08:34:24 AutoIt3.exe ended.rc:0
+>08:34:24 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 228.6

Here is a video of it working. (Sorry about the quality I had to reduce it so I could post) Note: I let it loop three times. 

Note: I am going to run a lot more tests before I call this "solved". Thank you very much for all your help and guidance. If you have any more tips or suggestions I will gladly listen and try them.  

Share this post


Link to post
Share on other sites

great it works 3 loops. Thats most likely due to removal of the RTI. caching in the wrappers.

After a page is saved/updated/refreshed all elements get a new reference by the browser and UIA framework needs to refind them before it can interact with them.

The logical properties are used to refind the technical uielement.

  • All the sleeps should not be needed within the wrappers there is a small delay set in this variable which is used in uiaction function
Global $UIA_DefaultWaitTime = 250
  • I am referring to the log from the wrappers there should be a folder log with files that gives you more info when debug is true named like
    20190814-205525066.XML
  • take a look at examples example 11 you can condense your script which will make it easier to maintain
    • You can put your definitions of the identication in an array
    • You can put your script in an array
  • Probably you dump only 0 as $oP11 is not found try $oP12 or change definition to 
     Local $oP11=_UIA_getObjectByFindAll($oP12, "controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children)

Share this post


Link to post
Share on other sites

@junkew Thank you very much! I found the log files that you kept mentioning. (They are full of stuff haha) :) I was looking in the wrong log folder. There are two example 11s. I will look at both. :D 

Again Thank you! You have been more than helpful and patience with me. I have learned a lot and had fun doing it. This is what I enjoy about coding it feels like we are all a team who can help each other by sharing knowledge, skills and not be afraid to show weakness or lack of knowledge become we can come together to solve each other's problems. Then once the code is done its like art and I love that feeling of accomplishment. 

NOTE: my code works and has successfully passed all my tests so I will now change this topic to "solved".  

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

  • Similar Content

    • By plankton
      Hi I want it to search for a specific color in certain area then excute the loop which presses ESC button and stop the loop when the color no longer present in that specific area.  Here is the example of my code. But it doesnt stop when color is disappeared.
       
      Pixelsearch(511, 455, 678, 501, 0xFFFFFF)
      If Not  @Error Then
      While 1
      Sleep(1000)
      Send("{ESC}")
      Pixelsearch(511, 455, 678, 501, 0xFFFFFF)
      If @Error Then Exitloop
       
    • By nooneclose
      Good morning, I have been thinking about trying to make my Autoit script run in the background. I found out today that it is impossible due to the UIA and mouseclick functions that I use. However, while reading other posts about running Autoit scripts in the background I saw a reply mentioning how a script like mine might be able to run on a VM while still giving me the ability to work on my Host OS. Can someone confirm this? 
      Here is a link to the thread where I saw VM mentioned. 
      the person who mentioned it was @ViciousXUSMC 
    • By nooneclose
      Good morning, I am having a hard time figuring out how to read or get the valve (628850) from the red squared box in the picture below. 

      Here is what I have tried so far. (see code below. Also, I'm very sorry my code is sloppy.)
       
      #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ;Allows for the combining of UDFs by disabling error messages. (I get error messages for "problems" that dont actually exsist) #include <AD.au3> ;Allows Active Directory functions #include <Array.au3> ;Allows special Array functions #include <Constants.au3> ;Allows constants to be used #include <Date.au3> ;Allows Date and Time functions #include <DateTimeConstants.au3> ;Allows Date and Time constant functions #include "DTC.au3" ;Allows Custom Date and Time functions #include <IE.au3> ;Allows Internet Explorer functions #include <Misc.au3> ;Allows the "is pressed" function to be used #include <MsgBoxConstants.au3> ;Allows Message box function to be used #include <OutlookEX.au3> ;Allows the Outlook functions #include <String.au3> ;Allows special string functions #include <StringConstants.au3> ;Allows String constant functions #include <Timers.au3> ;Allows timer functions ;#RequireAdmin ;Requests admin privliges before starting program #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <debug.au3> #include <WinAPI.au3> #include "UIAWrappers.au3" #AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os ; Sets the script to accept coordinates off the program window and not the screen AutoItSetOption('MouseCoordMode', 0) ; Defines the time it takes to send text to the software/program AutoItSetOption('SendKeyDelay', 10) ;******************************************************************************* ; Close the script if "End" is pressed ;******************************************************************************* Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") HotKeySet("{END}", "Terminate") Func Terminate() MsgBox($MB_ICONINFORMATION, "DEATH", "AI Stoped!", 5) Exit EndFunc ;******************************************************************************* ; Script has started ;******************************************************************************* Sleep(2000) MsgBox($MB_ICONINFORMATION, "WO_AI", "AI Started!", 5) Sleep(1500) ;******************************************************************************* ; Main functions of the program ;******************************************************************************* test() ;=============================================================================== ; Function Definitions ;=============================================================================== Func test() MsgBox("", "TESTing", "Timer Started") Sleep(15000) MsgBox("", "TESTing", "timer Finished") ;~ *** Standard code maintainable *** AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Work Order Tracking - Google Chrome;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1") ;Work Order Tracking - Google Chrome _UIA_setVar("oP2","Title:=Work Order Tracking;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND") ;Work Order Tracking _UIA_setVar("oP3","Title:=  Work Order Tracking;controltype:=UIA_CustomControlTypeId;class:=") ;  Work Order Tracking _UIA_setVar("oP4","Title:=main form;controltype:=UIA_GroupControlTypeId;class:=") ;main form _UIA_setVar("oP5","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP6","Title:=View Work Details;controltype:=UIA_CustomControlTypeId;class:=") ;View Work Details _UIA_setVar("oP7","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP8","Title:=Location: Location description Long Description Include Children? Include Children: unchecked Include Ancestors? Include Ancestors: unchecked Include History? Include History: unchecked Work Scope Minimize Work Scope Section Minimize Work Scope Section Work Scope Work Close Filter CTRL+Z Close Filter CTRL+Z Filter Filter Table Filter Table Next Row [CTRL+Down Arrow] Next Row [CTRL+Down Arrow] 1 - 4 of 4 Download Hide Table: Work Hide Table: Work Work Work Table Button Group;controltype:=UIA_CustomControlTypeId;class:=") ;Location: Location description Long Description Include Children? Include Children: unchecked Include Ancestors? Include Ancestors: unchecked Include History? Include History: unchecked Work Scope Minimize Work Scope Section Minimize Work Scope Section Work Scope Work Close Filter CTRL+Z Close Filter CTRL+Z Filter Filter Table Filter Table Next Row [CTRL+Down Arrow] Next Row [CTRL+Down Arrow] 1 - 4 of 4 Download Hide Table: Work Hide Table: Work Work Work Table Button Group _UIA_setVar("oP9","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP10","Title:=Work;controltype:=UIA_TableControlTypeId;class:=") ;Work _UIA_setVar("oP11","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP12","Title:=Record Detail Menu;controltype:=UIA_DataItemControlTypeId;class:=") ;Record Detail Menu ; Clicks on the main record field _UIA_setVar("oUIElement","Title:=Record ;controltype:=UIA_EditControlTypeId;class:=") ;ControlType:=UIA_EditControlTypeId;classname:=") ; Trying to click on / get value from the 3rd from top record field (this is me trying to use the id to access the record box) Local $otest =_UIA_getObjectByFindAll("Record.mainwindow", "id:=ma9038468_tdrow_[C\:1]_txt-tb[R\:3].;ControlType:=UIA_DataItemControlTypeId", $treescope_subtree) ;~ 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("oP8","highlight") _UIA_Action("oP8","setfocus") ;~_UIA_Action("oP9","highlight") _UIA_Action("oP9","setfocus") ;~_UIA_Action("oP10","highlight") _UIA_Action("oP10","setfocus") ;~_UIA_Action("oP11","highlight") _UIA_Action("oP11","setfocus") ;~_UIA_Action("oP12","highlight") _UIA_Action("oP12","setfocus") _UIA_action("oUIElement","highlight") _UIA_Action("oUIElement","setfocus") _UIA_action("oUIElement","click") Sleep(2500) _UIA_action($otest,"highlight") _UIA_Action($otest,"setfocus") _UIA_action($otest,"click") MsgBox("", "End of program", "death") EndFunc I'm using $otest to try and click on the box, through the id that chrome gives it, with the UIA functions. I am kind of completely new to the UIA UDF but I do find it capable of doing a lot of cool things.   
      as always any help would be greatly appreciated. I know how hard you people hard. Thank you for taking the time to help us. 
×
×
  • Create New...