Jump to content
Sign in to follow this  

How can drop-down lists be read?

Recommended Posts


Let's say that I'd like to get the current values of drop-down boxes in some other program. Everyone has Notepad right? So how about reading the "Type of File:" drop-down from File -> Open in Notepad ?

I'd assume I'd use something like this.

WinWaitActive("Open"); wait for the Open window
MsgBox(0,"", GUICtrlRead(1136)); read the file type drop-down (ID 1136) and display the result in a Message Box

But the result is always 0 which means GUICtrlRead failed to read the value of the control. I've spent hours looking at the help file, searching Google, asking on the IRC channel and looking at the forum but I can't find an answer. Can someone explain how to do this and/or what I'm doing wrong?

Share this post

Link to post
Share on other sites

Controls change every time a program loads so a specific control number will not work. There were some functions designed to hook into other windows, I'll see if I can locate them. Post them as soon as I find them.

As well you can have the mouse hover over the control and return the number? AutoIt was meant to Automate. Get creative!

Edit : Look up ControlGetFocus and ControlCommand for mouse over/keyboard focused control grabbing.

Edited by AutoIt Smith

Share this post

Link to post
Share on other sites

i did not understand what exactly U want ti do, but to get the value in the combobox ??

i dont get the point .. but for the example of notepad that's work :

MsgBox(0,"", ControlCommand("","","ComboBox3","GetCurrentSelection",""))

ComboBox3 is the control name of the 'files type' field in the windows open file dialog ..

I hope that's help !!!

tester under construction ... please waitÂ…

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.