ControlCommand可以确定窗口中的复选框是否选中状态,然后可以对这些复选框进行操作。
可以对ComboBox和ListBox进行操作如选择下拉框的某个选项
if WinExists("AutoIt 帮助") Then MsgBox(1,"OK", "Start") WinActivate("AutoIt帮助") if ControlCommand("AutoIt 帮助","","Button5","IsChecked", "") Then ControlCommand("AutoIt帮助","", "Button5","UnCheck", "") ControlCommand("AutoIt帮助","", "Button6","UnCheck", "") ControlCommand("AutoIt帮助","", "Button7","UnCheck", "") Else ControlCommand("AutoIt帮助","", "Button5","Check", "") ControlCommand("AutoIt帮助","", "Button6","Check", "") ControlCommand("AutoIt帮助","", "Button7","Check", "") EndIf EndIf
ControlCommand(“窗口标题”, "", 控件类名或ID ,"SelectString", 选中选项文本)
而针对Radio CheckBox等选择类型的控件
ControlCommand(“窗口标题”, "",控件类名或ID,"check", ””)
而对于ListBox类型的选择框�则需要通过一系列组合来操作选项�如下面是获取所有选项数据的例子:
WinActivate(“窗口标题”) $hWnd= ControlGetHandle(“窗口标题”, "", “控件ID”) $count= _GUICtrlListBox_GetCount($hWnd) For $i=0 To $count-1 $hLabel= _GUICtrlListBox_GetText($hWnd, $i) Next