在上一版中新加了ControlTreeView()用来操作TreeView控件,这个函数让几天热衷于monkey-click的我看到了光明。一般来说,SysTreeView控件和SysListView是合着用的,一个在左一个在右,前者是键,后者是值。ControlListView函数的作用是向SysTreeView控件发送命令,如下(参照help)
ControlListView ( "title", "text", controlID, "command" [, option1 [, option2]] )
这里的title和text是指SysTreeView控件所在的窗口的标题和文本。
Command, Option1, Option2 
Operation 
"DeSelect", From [, To] 
Deselects one or more items. 
"FindItem", "string to find" [, SubItem] 
Returns the item index of the string. Returns -1 if the string is not found. 
"GetItemCount" 
Returns the number of list items. 
"GetSelected" [, option] 
Returns a string containing the item index of selected items. If option=0 (default) only the first selected item is returned. If option=1 then all the selected items are returned delimited by |, e.g: "0|3|4|10". If no items are selected a blank "" string is returned. 
"GetSelectedCount" 
Returns the number of items that are selected. 
"GetSubItemCount" 
Returns the number of subitems. 
"GetText", Item, SubItem 
Returns the text of a given item/subitem. 
"IsSelected", Item 
Returns 1 if the item is selected, otherwise returns 0. 
"Select", From [, To] 
Selects one or more items. 
"SelectAll" 
Selects all items. 
"SelectClear" 
Clears the selection of all items. 
"SelectInvert" 
Inverts the current selection. 
"ViewChange", "view" 
Changes the current view. Valid views are "list", "details", "smallicons", "largeicons".
命令还挺多,所以足够满足我们的需求。
在写脚本的时候碰到了一个问题,先是从SysTreeView中选择正确的键,然后想对SysListView相应的值做出修改。但是修改却始终不能生效。仔细想了想,哦,原来在修改之前是要给SysListView加个焦点的,否则某些操作(一般是判断)可以进行,但是却没效果,并且阻碍下面操作语句的执行。所以得加一句话:
ControlFocus("窗口标题","窗口文本","SysListView321")
posted on 2010-10-13 14:58  Jessica Lu  阅读(877)  评论(1)    收藏  举报