Jump to content

How to grab content of a List ?


Recommended Posts

Hi, i have some trouble with this simple script:

$Title = "[CLASS:WindowsForms10.window.8.app.0.378734a]"
$listview_test = "[CLASS:WindowsForms10.window.8.app.0.378734a4]"
$ItemsNo = ControlListView ($Title,"",$listview_test,"GetItemCount")
MsgBox(1,"Item Selected ", $ItemsNo)

The value returns 0 while there are actually 14 items in the list. What am i doing wrong?

Doesn't AutoIt work with the List view of Windows Forms?

Link to comment
Share on other sites

Try it this way, and post what you get:

#Include <GuiListView.au3>

Global $Title = "[CLASS:WindowsForms10.window.8.app.0.378734a]"
Global $listview_test = "[CLASS:WindowsForms10.window.8.app.0.378734a4]"

Global $hWnd = WinGetHandle($Title)
ConsoleWrite("$hWnd = " & $hWnd & @LF)

Global $hLV = ControlGetHandle($hWnd, "", $listview_test)
ConsoleWrite("$hLV = " & $hLV & @LF)

Global $ItemsNo = _GUICtrlListView_GetItemCount($hLV)
ConsoleWrite("$ItemsNo = " & $ItemsNo & @LF)

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Is that "4" on the end of the control ID actually part of the class name, or an instance number? Maybe it was supposed to be:

"[CLASSNN:WindowsForms10.window.8.app.0.378734a4]"

Or:

"[CLASS:WindowsForms10.window.8.app.0.378734a; INSTANCE:4]"

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

It's indeed instance number 4, so i changed the code, getting the following output:

$hWnd = 0x00020A6E

$hLV = 0x00030A82

$ItemsNo = 0

But at the moment of running the script, there are actually 22 items in that list as i've counted by hand.

Link to comment
Share on other sites

Well, a step closer. Got the window handle and the control handle. Which code did you use to get the count, ControlListView() or _GUICtrlListView_GetItemCount()?

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

#Include <GuiListView.au3>

Global $Title = "[CLASS:WindowsForms10.window.8.app.0.378734a]"
Global $listview_test = "[CLASS:WindowsForms10.window.8.app.0.378734a; INSTANCE:4]"

Global $hWnd = WinGetHandle($Title)
MsgBox(0, "Test", "$hWnd = " & $hWnd & @LF)

Global $hLV = ControlGetHandle($hWnd, "", $listview_test)
MsgBox(0, "Test", "$hLV = " & $hLV & @LF)


Global $ItemsNo = _GUICtrlListView_GetItemCount($hLV)
MsgBox(0, "Test", "$ItemsNo = " & $ItemsNo & @LF)

This code leads to:

$hWnd = 0x00020A6E

$hLV = 0x00030A82

$ItemsNo = 0

So that's the function _GUICtrlListView_GetItemCount()

Edited by ultim
Link to comment
Share on other sites

Rats. That indicates it's not a Windows API ListView control, but rather a custom class that AutoIt isn't going to be able to do anything with.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...