Jump to content

SysListView32 control handling


riddertje
 Share

Recommended Posts

ControlListView("Add", "List1", 1002, "SelectAll");

I'm trying to select all the items in a listview of the utility PowerPost. Below is a screenshot of the app with auto it window info tool on top of it. Could anyone help me understand why the above line won't select all the available options?

Posted Image

Link to comment
Share on other sites

ControlListView("Add", "List1", 1002, "SelectAll");

I'm trying to select all the items in a listview of the utility PowerPost. Below is a screenshot of the app with auto it window info tool on top of it. Could anyone help me understand why the above line won't select all the available options?

Because a SysListView32 is not the same thing as a ListView. There are some similarities, but many differences. If you get PaulIA's Auto3Lib UDF, which includes the A3LListView.au3 UDF, you might get some things to work, but it won't be fully functional. Same with the _GuiCtrlListView* included functions in the recent versions of AutoIt.

I don't know enough about it to say for sure, but evidently Microsoft has chosen not to document the interface for that type of control for some reason.

There was a SysListView UDF a long time ago, but I don't think it is currently maintained (try the search).

In short... SysListView is a bad spot in scripted automation right now.

:)

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

Because a SysListView32 is not the same thing as a ListView. There are some similarities, but many differences.

I don't know what are you talking about.

I use ControlListview()  and also Auto3Library successfully on SysListView32 controls all the time.

Edited by Zedna
Link to comment
Share on other sites

I don't know what are you talking about.

I use ControlListview() and also Auto3Library successfully on SysListView32 controls all the time.

I've had some success, and other places where it didn't work at all. Some of the SharePoint Backup/Restore utility windows were part of it, I believe (don't have them in front of me to play with right now). I was relaying problems I had run into some time ago: SysListView32 controls that refused to give the same results as ListViews.

It's easy to believe you know more about it than I do, though, and maybe I should go back and take another shot at those scripts...

:)

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

PsaltyDS run an an autoitscript that has a listview in it, and run the au3info on it, you'll see it is a SysListView32 control

Well, it wouldn't be the first time I was just plain wrong, and surely won't be the last. I'll have to go back and review what I was doing about 18 months to two years ago that gave me such fits with SysListView32...

:)

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

Thank you guys, but could anyone give me an example how exactly this Auto3Lib thing would be in code? I downloaded and installed it and read the help file on the ListView module, but I can't quite figure it out. Can I include those extension files directly?

It looks to me like all the functions are based on an own created GUI, since it referres to an 'handler' which I can't seem to find in the autoit window info program. What should I use for that?

_ListView_SetItemChecked($hWnd, $iIndex[, $fCheck, $fMove])

Parameters

$hWnd Handle to the control 
$iIndex Zero based index of the item 
$fCheck [Optional] Item check state:
 True - Check item

False - Uncheck item
Default value is True.
 
$fMove [Optional] If True, the mouse will be moved. If False, the mouse does not move. Default value is False.
Link to comment
Share on other sites

Thank you guys, but could anyone give me an example how exactly this Auto3Lib thing would be in code? I downloaded and installed it and read the help file on the ListView module, but I can't quite figure it out. Can I include those extension files directly?

It looks to me like all the functions are based on an own created GUI, since it referres to an 'handler' which I can't seem to find in the autoit window info program. What should I use for that?

Look at examples:

"c:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3"

"c:\Program Files\AutoIt3\Auto3Lib\ListView 2.au3"

Auto3Lib is primary intented to control external applications.

Link to comment
Share on other sites

I've had some success, and other places where it didn't work at all. Some of the SharePoint Backup/Restore utility windows were part of it, I believe (don't have them in front of me to play with right now). I was relaying problems I had run into some time ago: SysListView32 controls that refused to give the same results as ListViews.

It's easy to believe you know more about it than I do, though, and maybe I should go back and take another shot at those scripts...

:)

PsaltyDS stay cool. I'm not god I just stated that I haven't this kind of problems like you said with these standard ListView controls.

No offense :)

Edited by Zedna
Link to comment
Share on other sites

Look at examples:

"c:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3"

"c:\Program Files\AutoIt3\Auto3Lib\ListView 2.au3"

Auto3Lib is primary intented to control external applications.

I can't get a hold of those examples... Bare in mind that I am just a newbie to AutoIT. I've used it a couple of times a while ago for some very basic clicking and stuff and I do PHP quite well, that's why I got this far already without significant knowledge about AutoIT, but this one really beats me.

All I want to do is check all those checkboxes in the listview of the given application. Now the AutoIT help file states the ControlListView() function, I tried different combinations of IDs, classes, names and texts to let AutoIT know where I'm talking about and I chose a command ("SelectAll") that was listed in the help file, but neither of them seems to work.

Then A3Lib. Using extensions to get such an easy and basic job done looks to me like a bit overkill. But well, all I want is to get it working. So hello A3Lib. But I don't have time to crawl through yet another (well documented) help file to find that one function to use to check all options in a listview.

Could anyone point it out to me? Which functions to use, that's all.. I'll figure it out with the help file how to use it and all...

Edited by riddertje
Link to comment
Share on other sites

Without Auto3Library would be live very sad ;-)

#include <A3LListView.au3>

$hList = ControlGetHandle("Add", "", "SysListView321")

; to check only first two items
;~ _ListView_SetItemChecked($hList, 0, True)
;~ _ListView_SetItemChecked($hList, 1, True)

; to check all items
For $i = 0 To _ListView_GetItemCount($hList) - 1
    _ListView_SetItemChecked($hList, $i, True)
Next
Edited by Zedna
Link to comment
Share on other sites

Without Auto3Library would be live very sad ;-)

#include <A3LListView.au3>

$hList = ControlGetHandle("Add", "", "SysListView321")

; to check only first two items
;~ _ListView_SetItemChecked($hList, 0, True)
;~ _ListView_SetItemChecked($hList, 1, True)

; to check all items
For $i = 0 To _ListView_GetItemCount($hList) - 1
    _ListView_SetItemChecked($hList, $i, True)
Next
It's a shame I can't get over and kiss you right now, if it were only for social and cultural reasons :)

You're my hero for all Friday :). That script just works like a charm!

Link to comment
Share on other sites

  • 4 years later...

Without Auto3Library would be live very sad ;-)

#include <A3LListView.au3>
$hList = ControlGetHandle("Add", "", "SysListView321")
;~ _ListView_SetItemChecked($hList, 0, True); to check 1st item
For $i = 0 To _ListView_GetItemCount($hList) - 1  ; to check all items
    ...

As Auto3Library seems to be integrated in AutoIT3, how should the above be coded today?

Should I call ControlListView($hList, "GetItemCount") ??? (incorrect nr of args)

Somehow I cannot find documentation on how to use control handles.

I need this functionality to manage a SysListView32 control.

Edited by Roland999
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

You can use ControlListView() for simple tasks

or you can use standard UDF GUIListView functions for more complicated tasks.

Look into Autoit's helpfile at

User Defined Functions Reference/GUIListView Management/

_GUICtrlListView_GetItemCount()

_GUICtrlListView_SetItemChecked()

There are nice examples.

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...