Giáo Trình How To Use AutoIt A Professional Manner part 116 docx

7 349 0
Giáo Trình How To Use AutoIt A Professional Manner part 116 docx

Đang tải... (xem toàn văn)

Thông tin tài liệu

"IsChecked" Returns the state of an item. 1:checked, 0:unchecked, -1:not a checkbox. "Select", "item" Selects an item. "Uncheck", "item" Unchecks an item (if the item supports it). The "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0- based. For example: Heading1 > H1SubItem1 > H1SubItem2 > H1SubItem3 > > H1S1SubItem1 Heading2 Heading3 Each "level" is separated by |. An index is preceded with #. Examples: Item Item Reference Heading2 "Heading2" or "#1" H1SubItem2 "Heading1|H1SubItem2" or "#0|#1" H1S1SubItem1 "Heading1|H1SubItem3|H1S1SubItem1" or "#0|#2|#0" References can also be mixed like "Heading1|#1". Remarks As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows. Related ControlCommand, ControlDisable, ControlEnable, ControlFocus, ControlGetPos, ControlGetText, ControlHide, ControlClick, ControlListView, ControlMove, ControlSetText, ControlShow, StatusbarGetText, WinMenuSelectItem, WinGetClassList Example ; Author: Zedna #include <GUIConstantsEx.au3> #include <TreeviewConstants.au3> #include <WindowsConstants.au3> $gui = GUICreate("ControlTreeview test", 212, 212) $treeview = GUICtrlCreateTreeView(6, 6, 200, 160, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) $h_tree = ControlGetHandle($gui, "", $treeview) $root = GUICtrlCreateTreeViewItem("Root", $treeview) $item1 = GUICtrlCreateTreeViewItem("Item 1", $root) $item2 = GUICtrlCreateTreeViewItem("Item 2", $root) $item3 = GUICtrlCreateTreeViewItem("Item 3", $root) $item4 = GUICtrlCreateTreeViewItem("Item 4", $root) $item41 = GUICtrlCreateTreeViewItem("Item 41", $item4) $item42 = GUICtrlCreateTreeViewItem("Item 42", $item4) $item5 = GUICtrlCreateTreeViewItem("Item 5", $root) GUISetState(@SW_SHOW) ; some examples ControlTreeView ($gui, "", $h_tree, "Expand", "Root") ControlTreeView ($gui, "", $h_tree, "Exists", "Root|Item 4") ControlTreeView ($gui, "", $h_tree, "Check", "Root|Item 4") ControlTreeView ($gui, "", $h_tree, "Select", "Root|Item 4") ControlTreeView ($gui, "", $h_tree, "Expand", "Root|Item 4") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Function Reference StatusbarGetText Retrieves the text from a standard status bar control. StatusbarGetText ( "title" [, "text" [, part]] ) Parameters title The title of the window to check. text [optional] The text of the window to check. part [optional] The "part" number of the status bar to read - the default is 1. 1 is the first possible part and usually the one that contains the useful messages like "Ready" "Loading ", etc. Return Value Success: Returns the text read. Failure: Returns "" (blank string) and sets @error to 1 if no text could be read. Remarks This functions attempts to read the first standard status bar on a window (Microsoft common control: msctls_statusbar32). Some programs use their own status bars or special versions of the MS common control which StatusbarGetText cannot read. For example, StatusbarText does not work on the program TextPad; however, the first region of TextPad's status bar can be read using ControlGetText("TextPad", "", "HSStatusBar1") StatusbarGetText can work on windows that are minimized or even hidden. Related ControlGetText, ControlCommand Example AutoItSetOption("WinTitleMatchMode", 2) $x = StatusbarGetText("Internet Explorer") MsgBox(0, "Internet Explorer's status bar says:", $x) Function Reference WinActivate Activates (gives focus to) a window. WinActivate ( "title" [, "text"] ) Parameters title The title of the window to activate. See Title special definition. text [optional] The text of the window to activate. Return Value Success: Returns 1. Failure: Returns 0 if window is not found or cannot be activated. Remarks You can use the WinActive function to check if WinActivate succeeded. If multiple windows match the criteria, the window that was most recently active is the one activated. WinActivate works on minimized windows. However, a window that is "Always On Top" could still cover up a window you Activated. @extended contains additional info about how the activated process was done. Related WinClose, WinSetState, WinTitleMatchMode (Option) Example WinActivate("[CLASS:Notepad]", "") Function Reference WinActive Checks to see if a specified window exists and is currently active. WinActive ( "title" [, "text"] ) Parameters title The title of the window to check. See Title special definition. text [optional] The text of the window to check. Return Value Success: Returns 1 if window is active. Failure: Returns 0 otherwise. Remarks None. Related WinExists, WinWait, WinWaitActive, WinWaitClose, WinWaitNotActive, WinTitleMatchMode (Option) Example If WinActive("Untitled -") Then MsgBox(0, "", "Window was active") EndIf Function Reference WinClose Closes a window. WinClose ( "title" [, "text"] ) Parameters title The title of the window to close. See Title special definition. text [optional] The text of the window to close. . "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0- based. For example: Heading1 >. "Heading1|#1". Remarks As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows. Related ControlCommand, ControlDisable,. window to check. part [optional] The " ;part& quot; number of the status bar to read - the default is 1. 1 is the first possible part and usually the one that contains the useful messages

Ngày đăng: 08/07/2014, 21:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan