Jump to content

Read the content of a TcxGrid cell from AutoIt


Chuckero
 Share

Recommended Posts

I'm using DevExpress TcxGrid in a Delphi application and AutoIt to some test automation. At this point AutoIt can not recognize the TcxGrid objects and it can not even read the content of the cells. In my test I have to do a simple search in the TcxGrid, read the content of a cell (A1), if the content is not what I expect I go to the next one (A2) and so on until find the content. Maybe I have to scroll down the list. When I find the content I have to select that line. Simple like that.

In other words, I need to read the cells content and select a specific line. The big problem is AutoIt not recognize non Windows standard objects. Any tip?

Just linking the things (same question in StackOverflow) https://stackoverflow.com/questions/63995382/read-the-content-of-a-tcxgrid-cell-from-autoit

Edited by Chuckero
Link to comment
Share on other sites

On 9/22/2020 at 1:49 PM, zeenmakr said:

you might want to look into 'iuiautomation ms framework'

Thanks for the tip, but I didn't find any information that this should work with TcxGrid, also, using this tool means restart my project from scratch. Did you already used MS UI Automation? It works with TcxGrid?

Link to comment
Share on other sites

Did you try using UIASpy? What results did you get? Most of us won't have access to a TcxGrid so we'll need more information to help you out.  

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

1 hour ago, Chuckero said:

using this tool means restart my project from scratch

well it depends on what you mean, autoit adopted it. make sure look around for a few options on UIASpy tool there are different versions by different people and some are by non autoit developers. you might find out you would prefer one over another. if you are familiar with the traditional 'AutoIt Window Info' tool then for UIA Spy is for this

take a look here

 

Link to comment
Share on other sites

I found a small demo app that uses TcxGrid and have the exact same behavior as my app, so everybody can use it to test (QuantumGrid.exe) :

https://www.alphaskins.com/randtip.php?num=32

 

Using the AutoIt Window Info I got this (no relevant info):

image.thumb.png.c981cc853287cae627da4fea3c04d857.png

 

Using UIASpy I got this:

image.thumb.png.fbcdbcf42375f7aa451bed1a230a2eee.png

 

I tried to understand the info provided by UIASpy but I still stuck. It looks like the TcxGrid is totally closed and have no interface to any test automation.

Link to comment
Share on other sites

I've been looking at the TcxGrid control in QuantumGrid.exe. It only supports MSAA (MS Active Accessibility) automation. But it's apparently not possible to get an overview of the entire Grid control. Only a single cell at a time if you click it. With AutoIt Window Info tool you can also get info about a single cell if you click it.

By far the easiest way of automation for your purpose is to use an OCR program eg. Tesseract which is already available in AutoIt. Ie. take one or more screenshots of the Grid control (it can be fully automated) and extract the text in the images with Tesseract. Then you have all the Grid text in a file. Then it's easy to solve the task described in first post.

Link to comment
Share on other sites

On 9/24/2020 at 5:12 PM, LarsJ said:

I've been looking at the TcxGrid control in QuantumGrid.exe. It only supports MSAA (MS Active Accessibility) automation. But it's apparently not possible to get an overview of the entire Grid control. Only a single cell at a time if you click it. With AutoIt Window Info tool you can also get info about a single cell if you click it.

By far the easiest way of automation for your purpose is to use an OCR program eg. Tesseract which is already available in AutoIt. Ie. take one or more screenshots of the Grid control (it can be fully automated) and extract the text in the images with Tesseract. Then you have all the Grid text in a file. Then it's easy to solve the task described in first post.

I just test this as you mentioned, in the QuantumGrid.exe is possible to click on the cells and edit the content, but just because the edition is enabled. In my app the edition is not enabled, so, is not possible to click on the cells... :( 

Also I tried Cheat Engine to check the memory, in the QuantumGrid.exe the memory looks very regular and easy to read and identify the fields, but in my application, I don't know why, there is no logic, the order of the field is different and there is no regular distance between the fields.

About OCR, I already thought about it but I'm trying to avoid using third party software. I think this going to be the solution.

I never used MSAA (MS Active Accessibility), I'll gonna check it.

Link to comment
Share on other sites

On 9/25/2020 at 6:12 PM, LarsJ said:

Inspect.exe in the Microsoft SDK supports MSAA automation. Switch to MSAA mode with the button in upper left corner.

I tried inspect.exe and also its successor "Accessibility Insights for Windows", but no lucky.
Now I'm pretty convinced the only way to manipulate the TcxGrid is using some kind of OCR... :(

Link to comment
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
 Share

  • Recently Browsing   0 members

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