Jump to content

Iterating through combobox


maets
 Share

Recommended Posts

Hi, new here and new to AutoIT.

I've been searching this forum for hours now so I ask the question myself instead.

How do I create a script that will iterate through a combobox in an external application,

and for every item in that combobox uncheck a checkbox, but only if that checkbox is enabled.

In pseudocode/java/c#-syntax it would be something like.

CODE
winactivate("The Application");

for each $item in combobox {

combobox.setCurrentItem($item);

if (checkbox.enabled) && (!checkbox.checked) {

checkbox.checked = false;

}

}

Link to comment
Share on other sites

Hi, new here and new to AutoIT.

I've been searching this forum for hours now so I ask the question myself instead.

How do I create a script that will iterate through a combobox in an external application,

and for every item in that combobox uncheck a checkbox, but only if that checkbox is enabled.

In pseudocode/java/c#-syntax it would be something like.

CODE
winactivate("The Application");

for each $item in combobox {

combobox.setCurrentItem($item);

if (checkbox.enabled) && (!checkbox.checked) {

checkbox.checked = false;

}

}

Is that in a Windows GUI, or an IE page? In Windows APIs I think it would have to be a ListView, not a Combo, to have checkboxes...

:)

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

Is that in a Windows GUI, or an IE page? In Windows APIs I think it would have to be a ListView, not a Combo, to have checkboxes...

:)

It's a Win GUI. The combo itself has no checkboxes but it controls the settings for each item, displayed with other components in the same gui. For example an item named "Project 1" could have that checkbox checked (and some other settings which I can control via DB), while the next one may have it

unchecked. Since this setting is only stored in the memory of the application I can't go around using the GUI.

Link to comment
Share on other sites

It's a Win GUI. The combo itself has no checkboxes but it controls the settings for each item, displayed with other components in the same gui. For example an item named "Project 1" could have that checkbox checked (and some other settings which I can control via DB), while the next one may have it

unchecked. Since this setting is only stored in the memory of the application I can't go around using the GUI.

_GuiCtrlComboGetList() will retrieve the list of items into a string.

StringSplit() will split the string into an array of items.

For/Next will iterate through the array of items.

ControlCommand() will check the status of the checkboxes using the "IsVisible", "IsEnabled", and "IsChecked" keywords.

:)

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

Thx for answering!

There's just one problem. What value should I assign to the $idCombo?

I've been trying some different approaches, like ObjGet without success.

From helpfile:

_GUICtrlComboGetList ( $idCombo [, $sDelimiter = "|" ] )

I need some way of "getting combo-reference" that will satisfy this function.

Link to comment
Share on other sites

Thx for answering!

There's just one problem. What value should I assign to the $idCombo?

I've been trying some different approaches, like ObjGet without success.

From helpfile:

_GUICtrlComboGetList ( $idCombo [, $sDelimiter = "|" ] )

I need some way of "getting combo-reference" that will satisfy this function.

$idCombo is the ControlID, which is a number assigned when the GUI was created. It can also be the ClassNameNN of the control. You can also substitute the Windows Handle which is a dynamic identifier unique to your entire Windows environment.

AutoIt comes with a tool that displays the details of controls in a window, including the ControlID and ClassNameNN. It's called "AutoIt Window Info" in the Start Menu, or the executable is Au3Info.exe in the AutoIt program files directory. Run that and check out the Control Tab while you mouse over the controls on your GUI.

:)

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

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