gpt4 book ai didi

vb.net - 无法使用 AutoIt 从 Windows 窗体的下拉列表中选择值

转载 作者:行者123 更新时间:2023-11-28 20:33:39 29 4
gpt4 key购买 nike

使用下面的代码

ControlCommand("Test Form", "", "[NAME:ctlMsgQueueCombo]", "ShowDropDown")
ControlSend("Test Form", "", "[NAME:ctlMsgQueueCombo]", "This is my default value (TEST) - First")

or

ControlCommand("Test Form", "", "[NAME:ctlMsgQueueCombo]", "ShowDropDown")
ControlSend("Test Form", "", "[NAME:ctlMsgQueueCombo]", "select", "This is my default value (TEST) - First")

它选择了组合框,但没有从列表中选择所需的“这是我的默认值 (TEST) - First”。基本上,它是选择以 t 开头的任何值。例如,第一个值是“TMP”。因此,它不是完全匹配,而是选择任何第一个字符匹配。我如何强制它从列表中选择确切的字符串?

我也尝试过使用以下代码,但似乎没有任何效果。

WinWaitActive($title)
$Index = _GUICtrlComboBoxEx_FindStringExact($hcombo, $sText)
_GUICtrlComboBoxEx_SetCurSel($hcombo, $Index)
or following
WinWaitActive($title)
$Index = _GUICtrlComboBox_FindStringExact($hcombo, $sText)
_GUICtrlComboBox_SelectString($hcombo, $Index)

最佳答案

现在您正在使用 ControlSend参数不正确。以下将发送字符串“select”,最后一个参数将被评估为 0。

ControlSend("Test Form", "", "[NAME:ctlMsgQueueCombo]", "select", "This is my default value (TEST) - First")

因为它期望 1 或 0 作为最后一个参数)。不用说,这不是您想要的。

你应该用 ControlCommand 做类似 SelectString 的事情.您不必先显示下拉菜单:

ControlCommand("Test Form", "", "[NAME:ctlMsgQueueCombo]", "SelectString", "This is my default value (TEST) - First")

我还没有能够测试它,但只要它找到了窗口并且字符串是正确的,那么它应该没问题。

关于vb.net - 无法使用 AutoIt 从 Windows 窗体的下拉列表中选择值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6368935/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com