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