AutoIt v3 中的 ControlCommand

发布于 2024-11-02 11:52:09 字数 650 浏览 0 评论 0原文

我正在尝试将 ControlCommands 与 .NET 应用程序一起使用(因此,这些都应该是标准的 Microsoft控制),但大多数感兴趣的似乎没有做任何事情。

我目前正在查看一个组合框(下拉框)。我使用“showdropdown”命令将其下拉,并且成功运行。

然后我尝试使用“SelectString”,但它没有转到我指定的字符串。 “SelectString”ControlCommand 选项如何工作?

我也尝试过“SetCurrentSelection”。

这是我使用的语句:

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

我也尝试先用:搜索它,

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

但也没有找到。奇怪的是,只有一个字符“a”。

如果有帮助,这是控件类:WindowsForms10.COMBOBOX

I am trying to use ControlCommands with 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虫児飞 2024-11-09 11:52:09

_GUICtrlComboBox_xxx 函数也适用于外部控件。例如,_GUICtrlComboBox_FindString_GUICtrlComboBox_SelectString_GUICtrlComboBox_SetCurSel。尝试一下这些。

先调用ControlGetHandle,然后使用该句柄调用上面的函数。

请记住包含 GuiComboBox 库,否则您将收到错误消息“Error: Unknown function name”:

#include <GuiComboBox.au3>

_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>
萌吟 2024-11-09 11:52:09

您可以将按键发送到此控件,像这样

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

它可以工作,因为 ComboBox 将输入解释为搜索字符串并选择第一个以此字符串开头的项目。

注意:因为它会在您键入时搜索匹配的项目,所以不需要发送完整的值,只需发送最短的子字符串。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文