AutoIt v3 中的 ControlCommand
我正在尝试将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
_GUICtrlComboBox_xxx
函数也适用于外部控件。例如,_GUICtrlComboBox_FindString
、_GUICtrlComboBox_SelectString
、_GUICtrlComboBox_SetCurSel
。尝试一下这些。先调用
ControlGetHandle
,然后使用该句柄调用上面的函数。请记住包含
GuiComboBox
库,否则您将收到错误消息“Error: Unknown function name”:_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":您可以将按键发送到此控件,像这样:
它可以工作,因为 ComboBox 将输入解释为搜索字符串并选择第一个以此字符串开头的项目。
You can send key presses to this control, like this:
It works because ComboBox interprets input as a search string and selects the first item starting with this string.