Giáo Trình How To Use AutoIt A Professional Manner part 31 pdf

6 293 0
Giáo Trình How To Use AutoIt A Professional Manner part 31 pdf

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

Thông tin tài liệu

Function Reference FileSaveDialog hiện ra một hộp thoại để lưu file FileSaveDialog ( "title", "init dir", "filter" [, options [, "default name" [, hwnd]]] ) Parameters title tên hộp thoại init dir thư mục chủ để lưu file vào trong đó filter định dạng kiểu file nào đc phép chọn vd "All (*.*)" hay "Text files (*.txt)" hoặc có thể lựa chọn kiểu file "All (*.*)|Text files (*.txt)" options 2 = đường dẫn phảo tồn tại 16 = hiện thông báo ghi đè file nếu file đã tồn tại default name tên mặc định hwnd handle của GUI mẹ Return Value Success: trả lại đường dẫn đầy dủ của file đc chọn, ở flag=4 thì trả lại "đường dẫn tới thư mục|file1|file2| " Failure: Sets @error to 1. Remarks ! Related FileOpenDialog, FileSelectFolder Example $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" $var = FileSaveDialog( "Choose a name.", $MyDocsFolder, "Scripts (*.aut;*.au3)", 2) ; option 2 = dialog remains until valid path/file selected If @error Then MsgBox(4096,"","Save cancelled.") Else MsgBox(4096,"","You chose " & $var) EndIf ; Multiple filter group $var = FileSaveDialog( "Choose a name.", $MyDocsFolder, "Scripts (*.aut;*.au3)|Text files (*.ini;*.txt)", 2) ; option 2 = dialog remains until valid path/file selected If @error Then MsgBox(4096,"","Save cancelled.") Else MsgBox(4096,"","You chose " & $var) EndIf Function Reference FileSelectFolder hiện ra một hộp thoại để chọn thư mục. FileSelectFolder ( "dialog text", "root dir" [, flag [, "initial dir" [, hwnd]]] ) Parameters dialog text đoạn văn bản hiện thị trên hộp thoại root dir thư mục chủ để chỉ định chỉ đc chọn trong thư mục này, sử dụng "" cho desktop flag 1 = hiện thị nút tạo folder mới (yêu cầu IE6+) 2 = hiện thị dòng nhập đường dẫn (yêu cầu IE5+) 4 = cho phép sửa tên thư mục initial dir thư mục mặc định, mặc định là "" hwnd handle tới GUI mẹ Return Value Success: đường dẫn tới folder đc chọn. Failure: Returns "" và sets @error to 1 nếu người dùng cancel hoặc đóng cửa sổ. Remarks The root dir will be chosen if the initial dir (if given) does not exist. A nonexistent root dir will also cause the Desktop folder to be root. The "Create Folder Button" option may require Windows XP with IE6 in order to work. Special Windows folders (such as "My Documents") can be set as root by using the right CLSID detailed in the Appendix. UNC paths are not supported. If you think that user's may choose files on a UNC path then the path needs to be mapped as a drive first. Related FileSaveDialog, FileOpenDialog, DriveMapAdd Example $var = FileSelectFolder("Choose a folder.", "") Function Reference FileSetAttrib thiết đặt các thuộc tính cho file. FileSetAttrib ( "file pattern", "+-RASHNOT" [, recurse] ) Parameters file pattern đường dẫn, có hỗ trợ kí tự đại diện +- RASHNOT thuộc tính recurse 1 = áp dụng cho tất cả thư mục con 0 = chỉ áp dụng chi file ở thư mục chỉ định (mặc định) Return Value Success: Returns 1. Failure: Returns 0 nếu có bất kì lỗi nào. Remarks file pattern ko thể chứa dấu cách (space) các thuộc tính đc liệt ke dưới đây, các thuộc tính có thể ghép liền với nhau (vd "RA" là readonly + archive) và kèm theo dấu "+" là bổ sung, "-" là loại bỏ "R" = READONLY "A" = ARCHIVE "S" = SYSTEM "H" = HIDDEN "N" = NORMAL "O" = OFFLINE "T" = TEMPORARY chú ý rằng các thuộc tính này ko thể đặt cho folder hay file nén đc Related FileGetAttrib, FileGetTime, FileSetTime Example ;mark all .au3 files in current directory as read-only and system If Not FileSetAttrib("*.au3", "+RS") Then MsgBox(4096,"Error", "Problem setting attributes.") EndIf ;make all .bmp files in C:\ and sub-directories writable and archived If Not FileSetAttrib("C:\*.bmp", "-R+A", 1) Then MsgBox(4096,"Error", "Problem setting attributes.") EndIf Function Reference FileSetTime thiết đặt thời gian cho file FileSetTime ( "file pattern", "time" [, type [, recurse] ] ) Parameters file pattern đường dẫn, có hỗ trợ kí tự đại diện time thời gian mới đc định dạng như sau: "YYYYMMDDHHMMSS" (Year, month, day, hours (24hr clock), seconds). nếu time = "" thì thời gian cũ sẽ đc dùng type thời gian nào sẽ đc thay đổi: 0 = lần sửa cuối cùng (mặc định) 1 = thời gian tạo file 2 = lần truy cập gần nhất . think that user's may choose files on a UNC path then the path needs to be mapped as a drive first. Related FileSaveDialog, FileOpenDialog, DriveMapAdd Example $var = FileSelectFolder("Choose. Failure: Sets @error to 1. Remarks ! Related FileOpenDialog, FileSelectFolder Example $MyDocsFolder = "::{450D8FBA-AD25-11D0-9 8A8 -0800361B1103}" $var = FileSaveDialog(. order to work. Special Windows folders (such as "My Documents") can be set as root by using the right CLSID detailed in the Appendix. UNC paths are not supported. If you think that user's

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

Từ khóa liên quan

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

Tài liệu liên quan