Jump to content

Need help getting text from a ListView control from an external application window

Recommended Posts

I am trying to use AutoIt to help me interact with an external application window with a list/grid view control. I need to get the text from the list. Depending on the value of the text of the items, highlight a specific item, then click a button. Ultimately I will need to do this over and over again (7K+ times) which is why I figured I'd use AutoIt. I have created other scripts and can interact with typical items like buttons, but this list/grid view is giving me a hard time. I can't seem to get text from it.

Here is the control I am trying to interact with: 


I will need to capture the text to figure out which item has "Vendor 2" (it's not always the second one listed). I'll need to select it then click a button to delete this item.


The info window is:



Here are a few things I've tried to get the text, but none work:

#include <GuiListView.au3>
local $result, $idListWindow, $idListView, $hWnd, $hWndCtrl
$hWnd = WinGetHandle($idListWindow)
$hWndCtrl = ControlGetHandle($idListWindow, "", $idListView)
;confirm I am working with the right window/control
ConsoleWrite("hWnd: " & $hWnd & @LF)
ConsoleWrite("hWndCtrl: " & $hWndCtrl & @LF)
;method 1
$result = ControlListView("", "", $idListView, "GetText", 0, 1)
ConsoleWrite("method 1: "& $result & @LF)
;method 2
$aItem = _GUICtrlListView_GetItemTextArray($idListview, 0)
For $i = 1 To $aItem[0]
  $result = StringFormat("Column[%2d] %s", $i, $aItem[$i]) & @CRLF
ConsoleWrite("method 2: "& $result & @LF)
;method 3
$result = ControlGetText("" ,"",$hWndCtrl)
ConsoleWrite("method 3: "& $result & @LF)


The handle of the main window are correct. Unfortunately, none of these 3 methods seem to work. Output I get is:

hWnd: 0x003C0A60
hWndCtrl: 0x00610B6C
method 1: 0
method 2: 0
method 3:
>Exit code: 0    Time: 0.8224


What can I use to be able to get text from this WindowsForms10.Window.8.app.0.b71fd5_r8_ad12 control?



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

  • Recently Browsing   0 members

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