AutoIT Help part 30 doc

7 331 1
AutoIT Help part 30 doc

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

Thông tin tài liệu

Function Reference FileGetSize trả lại dung lượng của file (tính = byte) FileGetSize ( "filename" ) Parameters filename đường dẫn tới file yêu cầu Return Value Success: trsr lại số > 0 Failure: trả lại 0 và set @error = 1 Remarks hàm ko làm việc với thư mục chia cho 1024 để đc kb, chia 1048576 để đc mb Related FileGetAttrib, FileGetTime, DriveSpaceTotal Example $size = FileGetSize("AutoIt.exe") Function Reference FileGetTime trả lại thông tin về thời gian của file FileGetTime ( "filename" [, option [, format]] ) Parameters filename đường dẫn tới file yêu cầu option xác định xem muốn lấy thời gian nào 0 = lần sửa file gần nhất (mặc định) 1 = thời gian tạo file 2 = lần truy cập file gấn nhất format xác định kiểu của giá trị trả lại 0 = trả lại một mảng (mặc định) 1 = trả lại một xâu kí tự YYYYMMDDHHMMSS Return Value Success: trả lại thông tin đc yêu cầu Failure: trả lại 0 và set @error = 1 Remarks mảng đc trả lại có định dạng như sau $array[0] = năm (4 chữ số) $array[1] = tháng (01 > 12) $array[2] = ngày (range 01 > 31) $array[3] = giờ (range 00 > 23) $array[4] = phút (range 00 > 59) $array[5] = giây (range 00 > 59) Related FileGetSize, FileGetAttrib, FileGetVersion, FileSetTime Example $t = FileGetTime(@Windowsdir & "\Notepad.exe", 1) If Not @error Then $yyyymd = $t[0] & "/" & $t[1] & "/" & $t[2] MsgBox(0, "Creation date of notepad.exe", $yyyymd) EndIf Function Reference FileGetVersion trả lại phiên bản của file FileGetVersion ( "filename" [,"stringname"] ) Parameters filename đường dẫn tới file yêu cầu stringname [optional] name of the field to be retried from the header version file info. Return Value Success: Returns a string containing the version information, e.g. "3.0.81.0". Failure: Returns "0.0.0.0" if no version information (or other error) or "" when retrieving a stringname, and sets @error to 1. Remarks stringname can be the basic one as : Comments, InternalName, ProductName, CompanyName, LegalCopyright, ProductVersion, FileDescription, LegalTrademarks, PrivateBuild, FileVersion, OriginalFilename, SpecialBuild Or a special one "CompiledScript" which is set for a compiled script. FileGetVersion(@AutoItExe, "CompiledScript") will return "AutoIt v3 Script : 3, 2, 1, 2". Another special stringname is "DefaultLangCodepage" can be used to retrieve the default language and codepage. The language and codepage can be used if needed to differentiate the "stringname" i.e. "080904b0\Comments" (see MSDN StringFileInfo in VerQueryValue function). Related FileGetSize, FileGetTime Example $ver = FileGetVersion("Explorer.exe") MsgBox(0, "Explorer version", $ver) Function Reference FileInstall bao gồm và cài đặt file khi biên dịch và thực thi FileInstall ( "source", "dest" [, flag] ) Parameters source đường dẫn tới file muốn "install". đư ờng dẫn n ày b ắt buộc phải r õ ràng và ko đc dùng biến ở đây có thể dùng .\ hay \ . dest đường dẫn tới nơi sẽ install file khi script chạy tới hàm này flag 0 = (mặc định) ko ghi đè 1 = ghi đè mọi file trùng tên Return Value Success: Returns 1. Failure: Returns 0. Remarks source là file sẽ đc add thêm vào file chạy khi biên dịch dest là nơi sẽ copy file source ở trong file chạy tới đó, nếu đuwongf dẫn này ko tồn tại thì hàm sẽ biij lỗi, để tránh đc lỗi này ta cần kiểm tra trước thu mục này có tồn tại hay ko = hàm FileExist, nếu chưa tồn tại thì cần thiết phảo tạo thư mục đó bằng hàm DirCreate Related #Include Example ; Include a bitmap found in "C:\test.bmp" with the compiled program and put it in "D:\mydir\test.bmp" when it is run $b = True If $b = True Then FileInstall("C:\test.bmp", "D:\mydir\test.bmp") Function Reference FileMove di chuyển file FileMove ( "source", "dest" [, flag] ) Parameters source file nguồn (hỗ trợ kí tự định dạng) dest đích đến (hỗ trợ kí tự định dạng) flag 0 = (mặc định) ko ghi đè 1 = ghi đè 8 = tạo ra mọi đường dẫn tới thư mục đích nếu chưa tồn tại Return Value Success: Returns 1. Failure: Returns 0 nếu file nguồn ko thể di chuyển (file trong ổ CD chẳng hạn), hoặc thư mục đích ko tồn tại (và flag=0) Remarks . "CompiledScript" which is set for a compiled script. FileGetVersion(@AutoItExe, "CompiledScript") will return " ;AutoIt v3 Script : 3, 2, 1, 2". Another special stringname. Related FileGetAttrib, FileGetTime, DriveSpaceTotal Example $size = FileGetSize(" ;AutoIt. exe") Function Reference FileGetTime trả lại thông tin về thời gian của file

Ngày đăng: 02/07/2014, 17:21

Từ khóa liên quan

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

Tài liệu liên quan