
키보드 단축키를 만들고 싶습니다.마우스 오른쪽 버튼 클릭 > 아카이브에 추가...Windows 파일 탐색기의 7z 기능입니다.
이것거의AutoHotkey와 함께 작동합니다:
#z::
SendInput {AppsKey}a{Enter}
Return
실제로 APPSKEY때로는 A괜찮습니다.
하지만 때로는 괜찮지 않을 때도 있습니다. 예를 들어 선택한 파일이 폴더인 경우:
문자 "A"에 대해 다른 메뉴 항목이 선택됩니다(여기서는 "MPC-HC 재생 목록에 추가").
중요 사항:
파일, 폴더, 가능한 모든 파일 확장자(가능한 확장자가 너무 많습니다!)에 대한 다양한 컨텍스트 메뉴 항목 에서 수동으로 찾을 수 있지만
regedit.exe
너무 길어질 것입니다... 그렇죠? (*)나는 이미"계단식 컨텍스트 메뉴"7z의 경우(이는7z-파일 관리자 > 도구 > 옵션... > 7-Zip메뉴), 상황은 더욱 심각합니다. 상황에 따라 문자가 동일하지 않아 일관된 단축키를 연결할 수 없습니다.
해결책은 7z가 상황에
&Add to archive...
맞는 메뉴 대신에 등록하는 것입니다. regedit 상황에 맞는 메뉴 설정을Add to archive...
잘 기억한다면 상황에 맞는 메뉴에서 문자 단축키를 사용하는 데 도움이 되는 것입니다.&
이에 대한 옵션이 있습니까? 안타깝게도 7-zip에서는 직접 사용할 수 없는 것 같습니다.
(*) 소수의 에디션으로도 가능할까요 regedit
? 즉, Add to archive...
로 바꾸시겠습니까 &Add to archive
? 몇 개의 키/값으로 이 작업을 수행해야 합니까? 안에:
HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\7-Zip
알겠어요:
{23170F69-40C1-278A-1000-000100020000}
이것이 유용할 수 있습니까?
답변1
이 시도
#IfWinActive ahk_class CabinetWClass ; explorer
#z::
ClipSaved := ClipboardAll ; save the entire clipboard to the variable ClipSaved
clipboard := "" ; empty the clipboard (start off empty to allow ClipWait to detect when the text has arrived)
Send, ^c ; copy selected item
ClipWait, 1 ; wait for the clipboard to contain data
if (!ErrorLevel) ; If NOT ErrorLevel ClipWait found data on the clipboard
{
; MsgBox, %clipboard% ; display the path
FileGetAttrib A, %clipboard%
if InStr(A, "D") ; is a folder
SendInput {AppsKey}aa{Enter}
else ; is a file
SendInput {AppsKey}a{Enter}
}
else
MsgBox, No file selected
Sleep, 300
clipboard := ClipSaved ; restore original clipboard
VarSetCapacity(ClipSaved, 0) ; free the memory
return
#IfWinActive
https://www.autohotkey.com/docs/commands/_IfWinActive.htm https://www.autohotkey.com/docs/misc/Clipboard.htm#ClipboardAll https://www.autohotkey.com/docs/commands/FileGetAttrib.htm
편집하다
ZIP할 파일을 여러 개 선택하면 이 방법이 작동합니다.
#IfWinActive ahk_class CabinetWClass ; explorer
#z::
folder := false
file := false
ClipSaved := ClipboardAll ; save the entire clipboard to the variable ClipSaved
clipboard := "" ; empty the clipboard (start off empty to allow ClipWait to detect when the text has arrived)
Send, ^c ; copy selected item
ClipWait, 1 ; wait for the clipboard to contain data
if (!ErrorLevel) ; If NOT ErrorLevel ClipWait found data on the clipboard
{
Loop, Parse, Clipboard, `n ; split by linefeed
{
LoopField := trim(A_LoopField, "`r`n") ; trim CRs/LFs
FileGetAttrib A, %LoopField%
if InStr(A, "D") ; is a folder
folder := true
else ; is a file
file := true
}
if (folder)
{
if (file) ; folders and files
SendInput {AppsKey}a{Enter}
else ; only folders
SendInput {AppsKey}aa{Enter}
}
else if (file) ; only files
SendInput {AppsKey}a{Enter}
}
else
MsgBox, No file selected
Sleep, 300
clipboard := ClipSaved ; restore original clipboard
VarSetCapacity(ClipSaved, 0) ; free the memory
return
#IfWinActive