Jump to content

Recommended Posts

Posted (edited)

I found a great function and I'm surprised that your library doesn't have a similar function. Why not? Sending keyboard presses (CTRL + C) is not convenient/suitable for everyone...

Func UIA_GetAeCurrentPropertyValue($oAe, $PropertyID)
    If Not IsObj($UIA_oUIAutomation) Then Return SetError(1)
    If Not IsObj($oAe) Then Return SetError(2)

    Local $tVal
    $oAe.GetCurrentPropertyValue($PropertyID, $tVal)
    If Not IsArray($tVal) Then Return $tVal
    Local $tStr = $tVal[0]
    For $i = 1 To UBound($tVal) - 1
        $tStr &= "; " & $tVal[$i]
    Next
    Return $tStr
EndFunc   ;==>UIA_GetAeCurrentPropertyValue

https://www.autoitscript.com/forum/topic/211768-automate-combobox-using-ui-automation/

Sorry for my English!!!

Edited by SEKOMD
Posted (edited)

There are many ways to set a value. More or less I added some wrappers and alias functions like

setvalue","settextvalue"
 "setvalue using keys"
 "setValue using clipboard"
 "getvalue"
 "sendkeys", "enterstring", "type", "typetext"

so no specific reason that certain ways are not there.

Edited by junkew
Posted
13 hours ago, junkew said:

"getvalue"

        Case "getValue"
            $obj2ActOn.setfocus()
            Send("^a")
            Sleep(50)
            Send("^c")
            $retValue = ClipGet()

only keyboard keys are used - this is not always convenient/reliable

when selecting text - for example, the input focus is lost..

  • 3 months later...
Posted (edited)

This is in the wrappers with propertyvalue, property and most likely when I wrote the library I had to deal with textboxes from java or other not fully iUIAutomation compatible textboxes and choosed to do it by keyboard commands and have another way to get to the propertys by a property command action.
 

Case "propertyvalue", "property"
            Local $i = _UIA_getPropertyIndex($p1)
            If Not @error <> 0 Then
                $retValue = _UIA_getPropertyValue($obj2ActOn, $UIA_propertiesSupportedArray[$i][1])
            Else
                $retValue = _UIA_getPropertyValue($obj2ActOn, $p1)
            EndIf

and implemented like

Func _UIA_getPropertyValue($UIA_oUIElement, $id)
    Local $tmpValue, $tmpStr, $iProperty

    If Not _UIA_IsElement($UIA_oUIElement) Then
        Return SetError($_UIASTATUS_GeneralError, $_UIASTATUS_GeneralError, "** NO PROPERTYVALUE DUE TO NONEXISTING OBJECT **")
    EndIf

    $UIA_oUIElement.GetCurrentPropertyValue($id, $tmpValue)
    $tmpStr = "" & $tmpValue
    If IsArray($tmpValue) Then
        $tmpStr = ""
        For $iProperty = 0 To UBound($tmpValue) - 1
            $tmpStr = $tmpStr & StringStripWS($tmpValue[$iProperty], $STR_STRIPLEADING + $STR_STRIPTRAILING)
            If $iProperty <> UBound($tmpValue) - 1 Then
                $tmpStr = $tmpStr & ";"
            EndIf
        Next
        Return $tmpStr
    EndIf
    Return SetError($_UIASTATUS_GeneralError, $_UIASTATUS_GeneralError, $tmpStr)
EndFunc   ;==>_UIA_getPropertyValue

And setting your keyboard focus back to begin or end could be done with keys like ctrl+home and ctrl+end. There are to many aspects in remotely controlling different applications and all kinds of different textboxes from different programming languages. Nowadays probably more and more html frontend applications but in 2010-2015 dealing with many windows UX technologies (Visual Basic, Java, Win32 forms, Delphi, HTML, QWidgets, ....)

Edited by junkew
Posted
1 hour ago, SEKOMD said:

Sorry, scrolling down the page - I understand this is not possible? Only using Send()?

Is that a question? You can interact with scrollbars using IUIAutomation. The wrappers I made are not wrapping all possibilities there are many examples made on the forum around IUIAutomation just search and you will find a lot. UIASpy is a nice one that gives you directly when you spy the ability to generate code for it.
Using the keyboard with send can be in many cases a good alternative its just one of the things you can use when you want to automate a GUI.

Microsoft supports the basic scrolling unfortunately many suppliers of derived scrollbars implement not full logic for IuIAutomation. Basically they should if they want to have their applications accessible for the impaired people.

https://learn.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-support-for-the-scrollbar-control-type 

 

  • 11 months later...
Posted

Hello, 
I currently have an Autoit script that "controls" a webpage running the Youtube Iframe API via embedded IE. It has become a bit unreliable recently so I've
decided to move over to Chrome and utilise UIAutomation to control the page.
I haven't started coding yet, just looking at what I'm currently doing in my existing script and how I can achieve the equivalent with UIAutomation.

At present, there is a textarea in the webpage HTML (id="event_log") which the javascript updates when the Youtube player changes status etc.
The autoit script utilises ObjEvent to fire off a function if the textarea changes i.e.
...
$xxx_event = $ie_o.document.all.event_log
ObjEvent($xxx_event, "jw_xxx_event_")
'''
Func jw_xxx_event_onPropertyChange() ;text in event_log field has changed

    Local $str = $xxx_event.value

    '''
EndFunc

Is there a way in UIAutomation where I can fire off a function if the textarea changes? It would be nicer than having to keep checking the textarea's value.

Thanks
 

Posted

I think You should move to WebDriver or WebView

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...