本帖最后由 autosonix 于 2009-5-19 15:06 编辑 ControlFocus ( "Chip List", "", 1019 )
SelectListViewItem("Chip List",1019 ,"SN8P1819A")
Sleep(3000)
send("{ENTER}") ;回车后得到的并不是我想要选的的SN8P1819A,而是虚框中项目???
;param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item Name
Func SelectListViewItem($WinName,$ControlID,$ItemName)
$ItemCount = ControlListView($WinName,"",$ControlID,"GetItemCount")
For $i = 1 to $ItemCount Step 1 ;use Loop to find given Item Name
$ItemText = ControlListView($WinName,"",$ControlID,"GetText",$i-1)
if StringCompare($ItemName,$ItemText)=0 then
ControlListView ($WinName, "", $ControlID, "SelectClear") ;Clears the selection of all items.
ControlListView ($WinName, "", $ControlID, "Select",$i-1) ;Selects given item.
Return
EndIf
Next
EndFunc
|