从 Outlook 插件中,我正在尝试从下拉列表中获取文本。
我有以下代码。
#Include <GuiComboBox.au3>
#Include <GuiComboBoxEX.au3>
#include <GUIListBox.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
global $hcombo = "[NAME:cboMeetingRooms]"
global $hcomboclass = "[CLASS:WindowsForms10.COMBOBOX.app.0.2d538d3_r86_ad4]"
global $title = "Lifesize Cloud Outlook Add-In Settings"
global $index = 0
local $sText = 'headset'
WinActivate($title)
sleep(3000)
local $shcombo = ControlGetHandle($title, "", $hcombo)
$Index = _GUICtrlComboBox_FindStringExact($shcombo, $sText)
ConsoleWrite($Index)
$tt = _GUICtrlComboBox_SelectString($shcombo, $Index)
ConsoleWrite($tt)
sleep(3000)
请帮我获取选定的字符串。我正在获得正确的索引,但未选择中的文本![在此输入图像描述][1]
我已经浏览了所有代码:(但没有找到结果
输出:
>"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut
"C:Usersmm1DesktopAutoITex.au3"
8-1>Exit code: 0 Time: 7.195
看看我如何使用 SetCurSel 设置选择,然后阅读所选项目的组合。
#Include <GuiComboBox.au3>
#Include <GuiComboBoxEX.au3>
#include <GUIListBox.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
global $hcombo = "[NAME:cboMeetingRooms]"
global $hcomboclass = "[CLASS:WindowsForms10.COMBOBOX.app.0.2d538d3_r86_ad4]"
global $title = "Lifesize Cloud Outlook Add-In Settings"
global $index = 0
local $sText = 'headset'
WinActivate($title)
sleep(3000)
local $shcombo = ControlGetHandle($title, "", $hcombo)
$Index = _GUICtrlComboBox_FindStringExact($shcombo, $sText)
ConsoleWrite($Index)
_GUICtrlComboBox_SetCurSel($shcombo, $Index)
$tt = GUICtrlRead($shcombo) ; this will give you the value that we set selected /w SetCurSel
ConsoleWrite($tt)
sleep(3000)