キーボードショートカットを作成したい右クリック > アーカイブに追加...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 のコンテキスト メニュー設定では、コンテキスト メニューで文字のショートカットを使用できるようになります。そのためのオプションはありますか? 残念ながら、これは 7-zip では直接利用できないようです。Add to archive...
&
regedit
(*)エディションが少ない場合でも可能ですか? つまり、Add to archive...
に置き換えますか&Add to archive
? いくつのキー/値でこれを行う必要がありますか? In:
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