Giáo Trình How To Use AutoIt A Professional Manner part 120 pot

7 106 0
Giáo Trình How To Use AutoIt A Professional Manner part 120 pot

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

Thông tin tài liệu

ProcessWait, ProcessWaitClose, ProcessList Example Run("notepad.exe") $pid = WinGetProcess("[CLASS:Notepad]") MsgBox(4096, "PID is", $pid) Function Reference WinGetState Retrieves the state of a given window. WinGetState ( "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 value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part you are interested in: 1 = Window exists 2 = Window is visible 4 = Window is enabled 8 = Window is active 16 = Window is minimized 32 = Window is maximized Failure: Returns 0 and sets @error to 1 if the window is not found. Remarks None. Related BitAND, WinGetPos Example ; Check if a new notepad window is minimized $state = WinGetState("Untitled", "") ; Is the "minimized" value set? If BitAnd($state, 16) Then MsgBox(0, "Example", "Window is minimized") EndIf Function Reference WinGetText Retrieves the text from a window. WinGetText ( "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 text read. Failure: Returns numeric 0 if no title match. Remarks Up to 64KB of window text can be retrieved. WinGetText works on minimized windows, but only works on hidden windows if you've set AutoItSetOption("WinDetectHiddenText", 1) If multiple windows match the criteria for WinGetText, the information for the most recently active match is returned. Use WinGetText("[active]") to get the active window's text. Related WinGetTitle, ControlGetText Example $text = WinGetText("Untitled -", "") MsgBox(0, "Text read was:", $text) Function Reference WinGetTitle Retrieves the full title from a window. WinGetTitle ( "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 complete window title. Failure: Returns numeric 0 if no title match. Remarks WinGetTitle("[active]") returns the active window's title. WinGetTitle works on both minimized and hidden windows. If multiple windows match the criteria, the most recently active window is used. Related AutoItWinGetTitle, WinGetText, WinSetTitle, WinTitleMatchMode (Option) Example $title = WinGetTitle("Untitled -", "") MsgBox(0, "Full title read was:", $title) Function Reference WinKill Forces a window to close. WinKill ( "title" [, "text"] ) Parameters title The title of the window to close. See Title special definition. text [optional] The text of the window to close. Return Value None. (Always returns 1 regardless of success.) Remarks The difference between this function and WinClose is that WinKill will forcibly terminate the window if it doesn't close quickly enough. Consequently, a user might not have time to respond to dialogs prompting the user to save data. Although WinKill can work on both minimized and hidden windows, some windows (notably explorer windows) can only be terminated using WinClose. Related WinActivate, WinClose, WinSetState, ProcessClose Example WinKill("Untitled - ", "") Function Reference WinList Retrieves a list of windows. WinList ( ["title" [, "text"]] ) Parameters title [optional] The title of the window to read. text [optional] The text of the window to read. Return Value Returns an array of matching window titles and handles. Remarks If no title and text is given then all top-level windows are returned. The array returned is two-dimensional and is made up as follows: $array[0][0] = Number of windows returned $array[1][0] = 1st window title $array[1][1] = 1st window handle (HWND) $array[2][0] = 2nd window title $array[2][1] = 2nd window handle (HWND) $array[n][0] = nth window title $array[n][1] = nth window handle (HWND) Related WinGetHandle Example $var = WinList() For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & . [optional] The text of the window to read. Return Value Success: Returns a value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part. a user might not have time to respond to dialogs prompting the user to save data. Although WinKill can work on both minimized and hidden windows, some windows (notably explorer windows) can. Parameters title [optional] The title of the window to read. text [optional] The text of the window to read. Return Value Returns an array of matching window titles and handles. Remarks

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