Kirky

Select an item from a listbox - newbie

10 posts in this topic

#1 ·  Posted

Please be gentle, I am new to this.

I am trying to automate the installation of a vendors application that can not be installed silently in the usual way (msi etc) so I am using AutoIT for the first time.

I have managed to use the AutoIT Windows Info to get most of the information I require when the answer is mainly next, Yes, enter etc.

However I am now stuck. I need to highlight an item on a list (AutoIT Windows info tells me it's a ListBox) but I can't find the correct function in order to do this. It seems to have sprung from really simple to really complicated.

Could anyone explain how to do this is really simple terms?

Please and thank you.

Share this post


Link to post
Share on other sites



#2 ·  Posted

@Kirky welcome to the forum. Can you please post the information from the Window Info Tool for the listbox? I am guessing it will be a  combination of ControlGetHandle and _GUICtrlListBox_ClickItem, but the window info tool will help immensely.

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted

I want to select and highlight the 1st item on the list and then select OK.

Share this post


Link to post
Share on other sites

#5 ·  Posted

WinGetHandle

ControlGetHandle

ControlCommand  using this option: "SelectString", 'string'


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#6 ·  Posted

Hi Jdelaney, thanks for your reply, are there any tutorials or sample scripts on how to use the options you have stated above? Thanks

Share this post


Link to post
Share on other sites

#7 ·  Posted

I've found some examples thanks. I will give it a try and let you know how I get on.

Share this post


Link to post
Share on other sites

#8 ·  Posted

I'm really sorry to sound stupid but scripting is new to me and so even though you have kindly given me some pointers jdelaney I still can't work out what to do!!!

Please could you possibly write what you have suggested in to a small script which shows me how to use the functions you suggested and I can then replace the values with those that are relevant to my project?

Share this post


Link to post
Share on other sites

#9 ·  Posted

Does this work?

 

$hWindow = WinGetHandle("Select AutoCAD")

$hControl = ControlGetHandle($hWindow, "", "[CLASS:ListBox; INSTANCE:1]")

ControlCommand($hWindow, "", $hControl, "SelectString", "Text of the item you want selected") ; Change this

 

1 person likes this

Share this post


Link to post
Share on other sites

#10 ·  Posted

Floops you are an absolute legend, thank you so much for sparing yourtime to help me, that worked perfectly. I guess I will get more used to the functions the more I use it.

Thanks again.

1 person likes this

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