从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)
Plz Plz Plz帮助我获取所选字符串。我正在获取正确索引,但未选择文本![在此处输入图像说明] [1]
我已经完成了所有代码:(但没有找到结果
输出:
>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut
"C:\Users\mm1\Desktop\AutoIT\ex.au3"
8-1>Exit code: 0 Time: 7.195
答案 0 :(得分:0)
看看我如何使用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)