Sign in to follow this  
Followers 0
ultim

How to grab content of a List ?

9 posts in this topic

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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Here is what i get from that script:

$hWnd = 0x00040916

$hLV =

$ItemsNo = 0

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

#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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I used to work with AutoHotkey, which didn't support it.

Then i moved to AutoIt for getting around this specific problem... so it seems this is going to be a dead end also :mellow:

Share this post


Link to post
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
Sign in to follow this  
Followers 0