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

5 266 0
Giáo Trình How To Use AutoIt A Professional Manner part 21 ppsx

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

Thông tin tài liệu

$mem = MemGetStats() MsgBox(0, "Total physical RAM (KB):", $mem[1]) Function Reference ConsoleRead Read from the STDIN stream of the AutoIt script process. ConsoleRead ( [peek = false[, binary = false ]]) Parameters peek If true the function does not remove the read characters from the stream. binary If true the function reads the data as binary instead of text (default is text). Return Value Success: Returns the data read. @extended contains the number of bytes read. Failure: Sets @error to non-zero if EOF is reached, STDIN is not connected for the process or other error. Remarks ConsoleRead reads from the console standard input stream of the AutoIt script process, which is normally used by console applications to read input from a parent process. ConsoleRead does not block, it will return immediately. In order to get all data, it must be called in a loop. Peeking on the stream does not remove the data from the buffer, however, it does return the available data as normal. By default, data is returned in text format. By using the binary option, the data will be returned in binary format. Related ConsoleWrite, ConsoleWriteError, Run Example ; Compile this script to "ConsoleRead.exe". ; Open a command prompt to the directory where ConsoleRead.exe resides. ; Type the following on the command line: ; echo Hello! | ConsoleRead.exe ; ; When invoked in a console window, the above command echos the text "Hello!" ; but instead of dispalying it, the | tells the console to pipe it to the STDIN stream ; of the ConsoleRead.exe process. If Not @Compiled Then MsgBox(0, "", "This script must be compiled in order to properly demonstrate it's functionality.") Exit -1 EndIf Local $data While True $data &= ConsoleRead() If @error Then ExitLoop Sleep(25) WEnd MsgBox(0, "", "Received: " & @CRLF & @CRLF & $data) Function Reference ConsoleWrite Writes data to the STDOUT stream. Some text editors can read this stream as can other programs which may be expecting data on this stream. ConsoleWrite ( "data" ) Parameters data The data you wish to output. This may either be text or binary. Return Value The amount of data written. If writing binary, the number of bytes written, if writing text, the number of characters written. Remarks The purpose for this function is to write to the STDOUT stream. Many popular text editors can read this stream. Scripts compiled as Console applications also have a STDOUT stream. This does not write to a DOS console unless the script is compiled as a console application Related ConsoleWriteError, ConsoleRead Example Local $var = "Test" ConsoleWrite("var=" & $var & @CRLF) ; Running this in a text editor which can trap console output should produce "var=Test" Function Reference ConsoleWriteError Writes data to the STDERR stream. Some text editors can read this stream as can other programs which may be expecting data on this stream. ConsoleWriteError ( "data" ) Parameters data The data you wish to output. This may either be text or binary. Return Value The amount of data written. If writing binary, the number of bytes written, if writing text, the number of characters written. Remarks The purpose for this function is to write to the STDERR stream. Many popular text editors can read this stream. Scripts compiled as Console applications also have a STDERR stream. This does not write to a DOS console unless the script is compiled as a console application Related ConsoleWrite, ConsoleRead Example Local $var = "Test" ConsoleWriteError("var=" & $var & @CRLF) ; Running this in a text editor which can trap console output should produce "var=Test" Function Reference DirCopy Copy một thư mục (tất cả file và thư mục con) DirCopy ( "source dir", "dest dir" [, flag] ) Parameters source dir thư mục nguồn dest dir thư mục đến flag = 0: (mặc định) ko copy đè khi trùng tên = 1: copy đè Return Value Success: Returns 1. Failure: Returns 0 nếu có bất kì nỗi nào trong quá trình copy Remarks nếu thư mục đích chưa có thì autoit sẽ tạo mới (nếu có thể) Related DirRemove, FileCopy Example . data to the STDERR stream. Some text editors can read this stream as can other programs which may be expecting data on this stream. ConsoleWriteError ( "data" ) Parameters data. immediately. In order to get all data, it must be called in a loop. Peeking on the stream does not remove the data from the buffer, however, it does return the available data as normal. By default,. expecting data on this stream. ConsoleWrite ( "data" ) Parameters data The data you wish to output. This may either be text or binary. Return Value The amount of data written.

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

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

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

Tài liệu liên quan