Giáo Trình How To Use AutoIt A Professional Manner part 119 ppsx

7 267 0
Giáo Trình How To Use AutoIt A Professional Manner part 119 ppsx

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

Thông tin tài liệu

Local $t[2] If IsArray($c) and IsArray($w) and IsArray($e) Then $t[0] = $c[0] + $w[0] + $e[0] + $x_adjust $t[1] = $c[1] + $w[1] + $e[1] + $y_adjust Return $t ;absolute screen coords of caret cursor Else SetError(1) EndIf EndFunc Function Reference WinGetClassList Retrieves the classes from a window. WinGetClassList ( "title" [, "text"] ) Parameters title The title of the window to read. See Title special definition. text [optional] The text of the window to read. Return Value Success: Returns a string containing the window classes read. Failure: Returns "" and sets @error to 1 if no window matches the criteria. Remarks Class names are linefeed (@LF) separated. WinGetClassList works on both minimized and hidden windows. Up to 64KB of text can be retrieved. If multiple windows match the criteria, the classes are read from the most recently active window. Related WinGetText, ControlCommand Example $text = WinGetClassList("Untitled -", "") MsgBox(0, "Text read was:", $text) Function Reference WinGetClientSize Retrieves the size of a given window's client area. WinGetClientSize ( "title" [, "text"] ) Parameters title The title of the window to read. See Title special definition. text [optional] The text of the window to read. Return Value Success: Returns a 2-element array containing the following information: $array[0] = Width of window's client area $array[1] = Height of window's client area Failure: Returns 0 and sets @error to 1 if windows is not found. Remarks If the window is minimized, the returned width and height values are both zero. However, WinGetClientSize works correctly on (non-minimized) hidden windows. If the window title "Program Manager" is used, the function will return the size of the desktop. If multiple windows match the criteria, the most recently active window is used. Related WinGetPos, WinMove Example $size = WinGetClientSize("[active]") MsgBox(0, "Active window's client size is (width,height):", $size[0] & " " & $size[1]) Function Reference WinGetHandle Retrieves the internal handle of a window. WinGetHandle ( "title" [, "text"] ) Parameters title The title of the window to read. See Title special definition. text [optional] The text of the window to read. Return Value Success: Returns handle to the window. Failure: Returns "" (blank string) and sets @error to 1 if no window matches the criteria. Remarks This function allows you to use handles to specify windows rather than "title" and "text". Once you have obtained the handle you can access the required window even if its title changes. Related WinSetTitle Example ; Identify the Notepad window that contains the text "this one" and get a handle to it ; Change into the WinTitleMatchMode that supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) ; Get the handle of a notepad window that contains "this one" $handle = WinGetHandle("classname=Notepad", "this one") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else ; Send some text directly to this window's edit control ControlSend($handle, "", "Edit1", "AbCdE") EndIf Function Reference WinGetPos Retrieves the position and size of a given window. WinGetPos ( "title" [, "text"] ) Parameters title The title of the window to read. See Title special definition. text [optional] The text of the window to read. Return Value Success: Returns a 4-element array containing the following information: $array[0] = X position $array[1] = Y position $array[2] = Width $array[3] = Height Failure: Returns 0 and sets @error to 1 if windows is not found. Remarks WinGetPos returns negative numbers such as -32000 for minimized windows, but works fine with (non-minimized) hidden windows. If the window title "Program Manager" is used, the function will return the size of the desktop. If multiple windows match the criteria, the most recently active window is used. Related WinGetClientSize, WinMove Example $size = WinGetPos("[active]") MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3]) Function Reference WinGetProcess Retrieves the Process ID (PID) associated with a window. WinGetProcess ( "title" [, "text"] ) Parameters title The title of the window to read. See Title special definition. text [optional] The text of the window to read. Return Value Success: Returns a numeric Process ID (PID). Failure: Returns -1. Remarks None. Related . supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) ; Get the handle of a notepad window that contains "this one" $handle = WinGetHandle("classname=Notepad",. [optional] The text of the window to read. Return Value Success: Returns a 2-element array containing the following information: $array[0] = Width of window's client area $array[1]. the criteria. Remarks This function allows you to use handles to specify windows rather than "title" and "text". Once you have obtained the handle you can access the

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

Từ khóa liên quan

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

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

Tài liệu liên quan