Jump to content

junkew

MVPs
  • Posts

    3,003
  • Joined

  • Last visited

  • Days Won

    12

junkew last won the day on January 10 2020

junkew had the most liked content!

About junkew

Profile Information

  • Location
    Netherlands, Oostzaan

Recent Profile Visitors

3,370 profile views

junkew's Achievements

  1. You only need to dig into example 1 as part of the initial uia source that was shared. Understand the findall as that's easier then treewalking.
  2. There is no limit. But dealing with the hierarchy can be troublesome. I frequently highlight controls during development or do a findall in a subtree which can be slower but is programming wise easier certainly when you start with uia. Dealing with html can potentially be easier with webdriver but both have a challenging learning curve.
  3. Just check a little further if UIAutomation out of the box can help you more. see faq 31 for example but just to see if uiautomation can help test with simplespy or a more mature advanced one. UIASpy (or try inspect.exe from Microsoft) I just tried to install telegram desktop for windows and its "seeing" some controls (but definitely not all)
  4. The uiwrappers logic is indeed a wrapper around MS UI automation with some concepts that can be done by just plain coding but if integrated in a more mature testing framework all kinds of abstraction layers can make life much easier certainly during maintenance Unfortunately never took the time to fix issues in the wrapper functions. But if simplespy is not highlighting controls then most likely you need commercial tools to do the automation stuff or fallback to bitblt and other pixel functions combined with mousemove and mouseclick. Maybe search findbmp function in examples section can help a little.
  5. Ring seems to miss the power of win32 so the whole windowsbase is missing like sendkeys, sendinput, com. It seems to be a nice language but misses a lot thats available in autoit for automating and controlling other applications. Maybe i am missing the documentation on how to do win32 stuff. I installed Ring and merging it with AutoIt would be similar to other attempts in other languages by making convenience functions that are equal in name to AutoIt but probably will behave a little different. Ring installs nice huge download huge pdf help file (2000+ pages), there is plenty of documentation but finding what you need can be harder. Nice compiling to standalone exe files It feels Very different but not hard to learn scite versus ringnotepad is similar in initial usage, just load and run an example from a folder Not a small executable, huge exe distribution 250+megabytes for below example helloworld Many examples Nicely just structured in plain folders It took me a while to find out how to deal with optional parameters (basically you need to pass a hash table) very flexible including renaming keywords so you could write ChangeRingKeyword see consolewrite Here a small function MsgBox and ConsoleWrite as a starter if someone starts making a compatibility library Load "guilib.ring" new qApp { $sString = "This is an example of writing to the console." ConsoleWrite($sString) // Running this in a text editor which can trap console output e.g. SciTE, will display value of $sString $myMessage="Hello Moon" MsgBox([:cTitle="Blank title", :cMessage=$myMessage]) exec() } //MsgBox([:flag=0, :cTitle="Blank title", :cMessage="Blank message", :timeout=0, :hwnd=0]) Func MsgBox pList new qMessagebox(null) { setwindowtitle(pList[:cTitle]) setText(pList[:cMessage]) setstandardbuttons(QMessageBox_Yes | QMessageBox_No | QMessageBox_Close) show() } func ConsoleWrite $someText { see $sometext } And here an example in purebasic
  6. You could read it just as a sequential file. See https://datatracker.ietf.org/doc/html/rfc2822 for eml standard.
  7. you should try with the different spying tools around what can be achieved and what not. QT Widgets seems to be hard to automate. I guess most chance is with the iaccessible interface examples that are around in the forum. But you have to experiment a lot and maybe its not possible. If you are developing the QT application yourself make sure you add the accessibility information see https://doc.qt.io/qt-6/accessible-qtquick.html https://doc.qt.io/qt-6/accessible.html
  8. SVG Example written to html, Creating it is fast. Loading it in the browser seems to be acceptable even for bigger grids. I have no solution for a simple way to convert the SVG to PNG or other formats. Some examples are around #include <FileConstants.au3> Global Const $CELL_SIZE = 30 Global Const $GRID_PADDING = 5 Global Const $MIN_CIRCLE_RADIUS = 5 Global Const $MAX_CIRCLE_RADIUS = 10 Global $START = TimerInit() Global $htmlFile func WriteHTMLHead() filewrite($htmlFile , "<!DOCTYPE html><html><body>") EndFunc func WriteHTMLFooter() filewrite($htmlFile , " </body></html>") endfunc func WriteSVGStart($grid_size) filewrite($htmlFile , "<svg width=""" & $grid_size*($CELL_SIZE+$GRID_PADDING) & """ height=""" & $grid_size*($CELL_SIZE+$GRID_PADDING)& """>") EndFunc func WriteSVGEnd() filewrite($htmlFile , " </svg>") EndFunc Func WriteSVGCircles($GRID_SIZE) Local $circleString For $i = 0 To $GRID_SIZE - 1 For $j = 0 To $GRID_SIZE - 1 Local $iRadius = Random($MIN_CIRCLE_RADIUS, $MAX_CIRCLE_RADIUS, 1) Local $iCenterX = $GRID_PADDING * 1.5 + $j * ($CELL_SIZE + $GRID_PADDING) + $CELL_SIZE / 2 Local $iCenterY = $GRID_PADDING * 1.5 + $i * ($CELL_SIZE + $GRID_PADDING) + $CELL_SIZE / 2 $circleString="<circle cx=""" & $iCenterX & """ cy=""" & $iCenterY & """ r=""" & $iRadius & """ stroke=""green"" stroke-width=""4"" fill=""yellow"" />" filewrite($htmlFile, $circlestring & @crlf) Next Next EndFunc ;==>DrawSVGCircles func writeGrid($grid_size) local $iCol local $iRow for $iRow=0 to $grid_size local $iRowY=($iRow*($CELL_SIZE+$GRID_PADDING)) filewrite($htmlFile , " <line x1=""0"" y1=""" & $iRowY & """ x2=""" & $grid_size*($CELL_SIZE+$GRID_PADDING) & """ y2=""" & $iRowY & """ style=""stroke:red;stroke-width:2"" />") next for $iCow=0 to $grid_size local $iCol=($iCow*($CELL_SIZE+$GRID_PADDING)) filewrite($htmlFile , " <line x1=""" &$iCol & """ y1=""0"" x2=""" & $iCol & """ y2=""" & $grid_size*($CELL_SIZE+$GRID_PADDING) & """ style=""stroke:red;stroke-width:2"" />") next EndFunc func exampleSVG($grid_size) $htmlFile = FileOpen("C:\demo\svgdemo.html", $FO_OVERWRITE ) WriteHTMLHead() WriteSVGStart($grid_size) writeGrid($grid_size) WriteSVGCircles ($grid_size) WriteSVGEnd() WriteHTMLFooter() fileclose($htmlFile) EndFunc exampleSVG(500)
  9. At schoolšŸ¤£https://www.w3schools.com/html/html5_svg.asp it really depends on your scenario usecase what and how you want to create it in a gui.
  10. Maybe generate an svg file which just would be plain text and very fast generated.
  11. Put the computer in a lockable cabinet. Much cheaper then finding a technical solution. Remote control that computer if you sometimes need access.
  12. Probably best to reinstall uiaspy then. You have to give more context to understand why you have that error in your code.
  13. No over here where it started with the initial UIAWrapper libraries which was taken bij @LarsJ further in many more examples and updated interfaces from Microsoft The UIAwrappers library can make life easier but never had the time to fix issues and improve. Some helper functions can be handy like highlight rectangle so you can see you found the area. But be aware that UIA is not easy to learn as a starter. I checked your Nitro PDF and Winamp and both are doable with UIA but can be hard and tedious. The tree of WinAmp is not nicely behaving (as its hard to get with tools like inspect.exe) with UIASpy you can get tot your controls by using keys F1-F4 when you hover over certain elements and 90% can be recognized and you can generate parts of the code with UIASpy Clicking can be done like UIA_MouseClick( $oTreeItem1 ) ConsoleWrite( "UIA_MouseClick( $oTreeItem1 )" & @CRLF ) but you have to write code for the whole hierarchy ; --- Condition to find window/control --- ConsoleWrite( "--- Condition to find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Winamp v1.x", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) and then below the window you find in detail more objects ; --- Condition to find window/control --- ConsoleWrite( "--- Condition to find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "1. DJ Mike Llama - Llama Whippin' Intro - Winamp [Stopped]", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pPane1, $oPane1 $oParent.FindFirst( $TreeScope_Descendants, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) and reaching your control of interest ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Audio", $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) Local $pTreeItem1, $oTreeItem1 $oPane1.FindFirst( $TreeScope_Descendants, $pCondition1, $pTreeItem1 ) $oTreeItem1 = ObjCreateInterface( $pTreeItem1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oTreeItem1 ) Then Return ConsoleWrite( "$oTreeItem1 ERR" & @CRLF ) ConsoleWrite( "$oTreeItem1 OK" & @CRLF ) I will clean it up a little and put the working example below later edit: cleaned up but unfortunately not working but gives you an idea on how to set this up step by step for winamp. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "includes\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder #include "includes\UIA_Functions.au3" ; Can be copied from UIASpy Includes folder #include "includes\UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder #include "includes\UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Condition to find window/control --- #Region Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Winamp v1.x", $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pWindow, $oWindow $oDesktop.FindFirst( $TreeScope_Children, $pCondition1, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "$oWindow ERR" & @CRLF ) ConsoleWrite( "$oWindow OK" & @CRLF ) #EndRegion #region ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Audio", $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pTreeItem1, $oTreeItem1 $oWindow.FindFirst($TreeScope_Descendants, $pCondition2, $pTreeItem1 ) $oTreeItem1 = ObjCreateInterface( $pTreeItem1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oTreeItem1 ) Then Return ConsoleWrite( "$oTreeItem1 ERR" & @CRLF ) ConsoleWrite( "$oTreeItem1 OK" & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) #endregion UIA_MouseClick( $oTreeItem1 ) ConsoleWrite( "UIA_MouseClick( $oTreeItem1 )" & @CRLF ) EndFunc
  14. Learn how the uia treewalkers work so you can navigate the tree of uia objects and then retrieve the relevant properties. The main thread in examples section on uiautomation first 10 examples will tell. Uia Findall could be easier but can be slow if not properly used. Uia will not work on java applications for that you have to google JAB and some experimental tryouts are around for AutoIt.
×
×
  • Create New...