Jump to content
Sign in to follow this  

Read Options In A Window?

Recommended Posts


This should be pretty straight forward.

I want to be able to read what options are available in a selection window.

Spcifically, as my training exersize I am writing an automation script for DVD Shrink to learn about how the processes of AutoIT all work. What I wanted to do is for GUI selection boxes such as when you select "Open Disk" I want some way of knowing what options are in the selection box.

Using the discovery tool I can see a heap of information:

>>>> Window <<<<
Title:  Open DVD Disc
Class:  #32770
Position:   324, 277
Size:   366, 209
Style:  0x94C800CC
ExStyle:    0x00010101
Handle: 0x005B06C4

>>>> Control <<<<
Class:  Button
Instance:   3
ClassnameNN:    Button3
Advanced (Class):   [CLASS:Button; INSTANCE:3]
Position:   12, 7
Size:   336, 104
ControlClick Coords:    177, 80
Style:  0x50000007
ExStyle:    0x00000004
Handle: 0x002B0798

>>>> Mouse <<<<
Position:   192, 116
Cursor ID:  0
Color:  0xECE9D8

>>>> StatusBar <<<<

>>>> Visible Text <<<<
Select DVD Drive:

>>>> Hidden Text <<<<

but wanted a way of grabbing spcifically the options that are available in the drop down box. I have 2 drives that I can select to open and as a test I would like to know how to read what options are available. I can easily do it at the moment by sending either an UP or DOWN command but the theory of this exercise can be used later.

On a similar note I would also like to know if/how I can read text that is selected in a window under a selection bar. This could be used in place of my previous requirement.

Share this post

Link to post
Share on other sites

I seem to be getting somewhere slowly.

I managed to read the first selected value with the following test:

WinActivate("DVD Shrink")
$var = ControlGetText("Open DVD Disc","", 1001)
MsgBox(0,"Test", "Text = "&$var&"")

This returns the selected disc drive letter with disk name. Now, how can I just grab the first 2 characters? I want to grab the "D:" (drive letter) and compare this to what the user has entered as a drive letter. If this is not correct then i'll send a {down} command and read the next value.

Share this post

Link to post
Share on other sites


I'm getting better at this :D

I have now done the following:

$i = 0

While $i <= 10
    WinActivate("Open DVD Disc")
    ControlFocus("Open DVD Disc", "", 1001)
    $var = ControlGetText("Open DVD Disc", "", 1001)
    $result = StringInStr("" & $var & "", "E:")
    $i = $i + 1
    If Not $result = 1 Then
MsgBox(0, "Test", "Text = " & $result & "")

Trying to find the "E:" drive which is below the "D:" drive in the dropdown box. I had to actually focus the GUIBox rather than the main program to send the keystroke for the next selection but I am now reading each option in turn until I find what I need. This goes a long way to make things easier and more reliable for me but any extra suggestions would be really helpful as i'm still learning the ropes.

Edited by jestermgee

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