Sign in to follow this  
Followers 0

How to get AU3_ControlListView to work?

2 posts in this topic

Someone (alanR) posted a thread showing how to use AutoIt in Java. There was another post that complained about not being able to get ControlGetText (or any other Control___ functions) to work in his application. I've had similar experiences and am trying to get help here.

What I'm trying to do is to invoke AutoIt functions in Matlab. This can be done by first loading the dll and h files. The AU3_ functions would then be accessible via the calllib protocol. For example,

calllib('AutoItX3','AU3_Run','calc','',1) would run the calculator

calllib('AutoItX3','AU3_CDTray','D:','OPEN') would pop open the CD tray

calllib('AutoItX3','AU3_MouseMove',-460,300,10) would move the mouse

These all worked and were a lot of fun.

However, I have not been able to get the AU3_ControlListView to work. This example,

calllib('AutoItX3','AU3_ControlListView','My Computer','','1','GetItemCount','10','3','',1)

which supposedly would get the number of items in a SysListView32 list (this list, a control, is simply the content of the "My Computer" window, the window you get when you double-click "My Computer" on the desktop). However, it would always return just the title of the window ("My Computer"). I've tried other commands such as GetText to no avail. The call would always return the title.

I think the problem may have to do with how the parameters were passed, but I'm not sure since I could not find the proper documentation. The help file that came with dll (autoitx.chm) is actually misleading in this particular case. For example, in the help file, it states that the ControlListView would take up to 6 parameters ("title", "text", "controlID", "command", "option1", "option2"). But as you can see from the above example, the call

calllib('AutoItX3','AU3_ControlListView','My Computer','','1','GetItemCount','10','3','',1) actually requires 8 parameters (7 cstrings and 1 int32). Without the proper parameters the call would always fail. This information was obtained from Matlab, not from AutoIt documentation. Matlab also shows that ControlListView would return 7 cstrings, which again I could find no information on in AutoIt documentation.

I should add that I have tested the same stuff in Visual Basic and there were no problems whatsoever, so it is not true that the help file is wrong, or that there's anything wrong with the dll. It just does not pertain well to issues within Matlab. I should also add that the two platforms approach dll differently. In VB, AutoIt is initiated as an object. In Matlab, the functions are just called. Matlab supports dll and com. The version I'm using is 7.4.0, very up to date. What is strange is that functions with simple return types would work while those with complicated return types would not. I would've tried instancing Matlab as an object if I knew how. Matlab uses actxcontrol to instance com objects. To do this, I believe, one would need to register AutoIt. I've registered AutoItX, but Matlab does not see any AutoItX-related ActiveX control.

What I need to do is to get the number of counts in a SysListView32 list and then get the text of individual items in that list. I wonder if someone can help? I would like to know how the parameters should be properly passed. Or, if someone can show me how to instance AutoIt as an object in Matlab. Many thanks in advance.

Share this post

Link to post
Share on other sites

"controlID" you use '1' is wrong

you must use AutoIt v3 information to get conrolID

i thing that may be 'SysListView321'

calllib('AutoItX3','AU3_ControlListView','My Computer','','SysListView321','GetItemCount','10','3','',1)

you can try again

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