GiainenbangAHK

; Giải nén file nhanh bằng WinRAR +!r:: ; Shift + Alt + R ; Đường dẫn đến thực thi của WinRAR WinRARPath := "C:\Program Files\WinRAR\WinRAR.exe" ; Gọi hàm giải nén ExtractFiles(WinRARPath) return ; Hàm giải nén các file đã chọn ExtractFiles(WinRARPath) { ; Lấy đường dẫn của tập tin đã chọn SelectedFile := GetSelectedFile() ; Kiểm tra xem có file nào được chọn không if (SelectedFile != "") { ; Lấy thư mục cha của file đã chọn FileGetAttrib, Attributes, %SelectedFile% ParentFolder := SubStr(SelectedFile, 1, InStr(SelectedFile, "\",, -1)) ; Tạo command line để giải nén file vào thư mục cha CommandLine := """" . WinRARPath . """ x -o+ """ . SelectedFile . """ """ . ParentFolder . """" ; Chạy command line RunWait, %CommandLine%, , Hide ; Kiểm tra xem giải nén file thành công hay không if (ErrorLevel = 0) { MsgBox, Giải nén file thành công! } else { MsgBox, Có lỗi xảy ra khi giải nén file! } } else { MsgBox, Vui lòng chọn ít nhất một file để giải nén. } } ; Hàm lấy đường dẫn của tập tin đã chọn GetSelectedFile() { ; Lấy vị trí hiện tại của Clipboard ClipboardBackup := ClipboardAll ; Gửi tổ hợp phím Ctrl + c để sao chép đường dẫn của tập tin đã chọn Send, ^c ; Đọc đường dẫn từ Clipboard SelectedFile := Clipboard ; Phục hồi nội dung Clipboard Clipboard := ClipboardBackup ; Trả về đường dẫn của tập tin đã chọn return SelectedFile }

Public Last updated: 2023-12-22 10:02:33 PM