开发者

ControlCommand in AutoIt v3

开发者 https://www.devze.com 2023-02-26 04:49 出处:网络
I am trying to use ControlCommands 开发者_如何学Gowith a .NET application (hence, these should all be standard Microsoft controls), but most of the ones that are of interest don\'t seem to do anything

I am trying to use ControlCommands 开发者_如何学Gowith a .NET application (hence, these should all be standard Microsoft controls), but most of the ones that are of interest don't seem to do anything.

I am currently looking at a combobox (the drop down box). I used the "showdropdown" command to have it drop down, and it worked successfully.

I then tried to use "SelectString", but it didn't go to the string that I specified. How does the "SelectString" ControlCommand option work?

I have also tried "SetCurrentSelection".

This is the statement I used:

ControlCommand($windowName, "", "[Name:myComboBox]", "SelectString", "a")

I have also tried searching for it first with:

ControlCommand($windowName, "", "[Name:myComboBox]", "FindString", "a")

but it didn't find it either. Strange, the single character "a" is there.

If it helps, this is the control class: WindowsForms10.COMBOBOX


_GUICtrlComboBox_xxx functions also work on external controls. For example, _GUICtrlComboBox_FindString, _GUICtrlComboBox_SelectString, _GUICtrlComboBox_SetCurSel. Try those instead.

Call ControlGetHandle first, then use this handle to call the functions above.

Remember to include the GuiComboBox library, otherwise you will get an error message "Error: Unknown function name":

#include <GuiComboBox.au3>


You can send key presses to this control, like this:

ControlSend("Window title", "", "[NAME:comboBoxName]", "ComboBox value")

It works because ComboBox interprets input as a search string and selects the first item starting with this string.

Note: Because it searches the matching item as you type, there's no need to send a complete value, only the shortest substring.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号