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

7 351 0
Giáo Trình How To Use AutoIt A Professional Manner part 25 pdf

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

Thông tin tài liệu

Return Value Success: Returns 1. Failure: Returns 0 nếu file handle ko đúng Remarks khi thoát khỏi chương trình autoit sẽ đóng tất cả các file do autoit đang mở. nhưng khuyến khích nên đóng file (fileclose) trước khi thoát. mở file ra ko dùng nữa thì đóng nó lại :| hàm này cũng được sử dụng để kết thúc việc tìm kiếm xử lý file handle như FileFindFirstFile (). Related FileFindFirstFile, FileOpen Example $handle = FileOpen("test.txt", 0) FileClose($handle) Function Reference FileCopy sao chép một hay nhiều file FileCopy ( "source", "dest" [, flag] ) Parameters source đường dẫn file nguồn (kí tự đại diện đc hỗ trợ vd *.exe) dest đường dẫn tới đích (thư mục hay file cũng đc) flag 0 = (mặc định) ko ghi đè 1 = ghi đè nếu trùng tên 8 = tạo ta thư mục đích nếu ko tồn tại. Return Value Success: Returns 1. Failure: Returns 0. Remarks nếu ko sử dụng flag 8 mà thư mục đích ko tồn tại thì hàm sẽ lỗi xem thêm hàm FileFindFirstFile để biết thêm thông tin về kí tự đại diện một số thuộc tính của file có thể làm ko ghi đè đc Related FileMove, FileDelete, DirCopy Example FileCopy("C:\*.au3", "D:\mydir\*.*") ; Method to copy a folder (with its contents) DirCreate("C:\new") FileCopy("C:\old\*.*", "C:\new\") FileCopy("C:\Temp\*.txt", "C:\Temp\TxtFiles\", 8) ; RIGHT - 'TxtFiles' is now the target directory and the file names are given by the source names FileCopy("C:\Temp\*.txt", "C:\Temp\TxtFiles\", 9) ; Flag = 1 + 8 (overwrite + create target directory structure) ; Copy the txt-files from source to target and overwrite target files with same name Function Reference FileCreateNTFSLink Creates an NTFS hardlink to a file or a directory FileCreateNTFSLink ( "source", "hardlink" [, flag] ) Parameters source Path of the source to which the hardlink will be created. hardlink Path of the hardlink. flag [optional] this flag determines whether to overwrite link if they already exist. Can be a combination of the following: 0 = (default) do not overwrite existing link 1 = overwrite existing link Return Value Success: Returns 1. Failure: Returns 0. Remarks The destination directory must already exist. This function works only on volume with NTFS File system. If the source is a file, the hardlink must be one the same volume. If the source is a directory cross volume is allowed. FileDelete or FileMove can be used on hardlink. To manage the link with the explorer you can use the shell extension NTFSLink Related FileCreateShortcut Example FileChangeDir(@ScriptDir) DirCreate('dir') FileWriteLine("test.txt","test") MsgBox(0,"Hardlink", FileCreateNTFSLink("dir\test.log", "test.txt",1)) Function Reference FileCreateShortcut tạo shortcut cho file. FileCreateShortcut ( "file", "lnk" [, "workdir" [, "args" [, "desc" [, "icon" [, "hotkey" [, icon number [, state]]]]]]] ) Parameters file đường dẫn đầy đủ của file cần tạo shortcut lnk đường dẫn đầy đủ shortcut workdir thư mục làm việc args Các tập tin đối số. desc Mô tả tập tin. icon đường dẫn tới icon của shortcut hotkey hotkey để chạy shortcut icon number số stt của icon muốn trong file icon (nếu tệp tin icon có nhiều hơn 1 icon), mặc định là 0 state kiểu mà khi chạy chương trình của shortcut sẽ áp dụng: @SW_SHOWNORMAL, @SW_SHOWMINNOACTIVE hay @SW_SHOWMAXIMIZED Return Value Success: Returns 1. Failure: Returns 0 nếu shortcut ko đc tạo ra Remarks Hotkeys for windows shortcuts are of the following form: Ctrl+Alt+X, Ctrl+Shift+X, Shift+Alt+X, Ctrl+NumPadKey, or Alt+NumPadKey where X represents a letter, number, punctuation, or function key. If you specify an invalid form, Windows typically defaults to Ctrl+Alt Note that Windows distinguishes number pad keys from regular number and punctuation keys. FileCreateShortcut allows you to create Ctrl+X and Alt+X shortcuts (which Windows normally only allows when X is a NumPadKey); however, you should avoid these assignments as they may conflict with standard application hotkeys. Windows prohibits ESC, ENTER, TAB, SPACEBAR, PRINT SCREEN, SHIFT, or BACKSPACE from being used in hotkeys. FileCreateShortcut does not require a valid target, workdir, icon, or hotkey in order to "successfully" create the LNK file; however, the destination of the LNK file must be valid! If the hotkey you choose is already in use, your new shortcut takes precedence. Also, if you create a shortcut with the same path\name as as a pre- existing shortcut, it gets overwritten with your new version. Related FileGetShortcut Example ; Sets a shortcut with ctrl+alt+t hotkey FileCreateShortcut(@WindowsDir & "\Explorer.exe",@DesktopDir & "\Shortcut Test.lnk",@WindowsDir,"/e,c:\", "This is an Explorer link;-)", @SystemDir & "\shell32.dll", "^!t", "15", @SW_MINIMIZE) Function Reference FileDelete Xóa file. FileDelete ( "path" ) Parameters Path đường dẫn tới file muốn xóa, kí tự đại diện đc hỗ trợ (vd \*.bak) Return Value Success: Return 1. Failure: Returns 0 nếu ko xóa đc hoặc file ko tồn tại . hardlink to a file or a directory FileCreateNTFSLink ( "source", "hardlink" [, flag] ) Parameters source Path of the source to which the hardlink will be created. hardlink Path. specify an invalid form, Windows typically defaults to Ctrl+Alt Note that Windows distinguishes number pad keys from regular number and punctuation keys. FileCreateShortcut allows you to create. create Ctrl+X and Alt+X shortcuts (which Windows normally only allows when X is a NumPadKey); however, you should avoid these assignments as they may conflict with standard application hotkeys.

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