Post by andymbody » 27 Jan 2023, 02:31
Updated 2023-01-27, 8:45am
Aquí hay dos métodos, pruebe ambos...
Seleccione el archivo zip en el Explorador de Windows, luego presione Ctrl+e o Ctrl+Shift+e
Code: Select all
#SingleInstance, force
global gSupportedExts := ".7z.zip.rar" ; add extensions to support (include preceeding period with each, no spaces!)
return
#IfWinActive, ahk_class CabinetWClass
; option 1 - use context menu
^e:: ; Ctrl+e
if (getFilePath()=="")
return
;SetKeyDelay, 30
SendInput, {AppsKey}7ee{enter} ; extract here
return
; option 2 - use command line
^+e:: ; Ctrl+Shift+e
fp := getFilePath()
if (fp=="")
return
SplitPath, fp,, oDir
7z := "C:\Program Files\7-Zip\7z.exe" ; change to path for 7zip executable
cmd := """" . 7z . """" . " x " . fp . " -o" . oDir . " -y"
Run, %cmd%,, Hide UseErrorLevel
; add Errorlevel handling if desired
return
#IfWinActive
;################################################################################
isZipFile(srcFileName)
{
SplitPath, srcFileName,,, oExt
needle := "i)(?>(\.\w{2,4}))(?=.*\1)"
haystack := gSupportedExts . " ." . oExt
RegExMatch(haystack, needle, m)
return (m != "")
}
;################################################################################
getFilePath()
{
SendInput, ^c
Sleep, 100
fp := Clipboard ; convert to text path
return isZipFile(fp) ? fp : "" ; verify that it is a zip file
}
[color=#FF0000]Updated 2023-01-27, 8:45am[/color]
Aquí hay dos métodos, pruebe ambos...
Seleccione el archivo zip en el Explorador de Windows, luego presione Ctrl+e o Ctrl+Shift+e
[code]
#SingleInstance, force
global gSupportedExts := ".7z.zip.rar" ; add extensions to support (include preceeding period with each, no spaces!)
return
#IfWinActive, ahk_class CabinetWClass
; option 1 - use context menu
^e:: ; Ctrl+e
if (getFilePath()=="")
return
;SetKeyDelay, 30
SendInput, {AppsKey}7ee{enter} ; extract here
return
; option 2 - use command line
^+e:: ; Ctrl+Shift+e
fp := getFilePath()
if (fp=="")
return
SplitPath, fp,, oDir
7z := "C:\Program Files\7-Zip\7z.exe" ; change to path for 7zip executable
cmd := """" . 7z . """" . " x " . fp . " -o" . oDir . " -y"
Run, %cmd%,, Hide UseErrorLevel
; add Errorlevel handling if desired
return
#IfWinActive
;################################################################################
isZipFile(srcFileName)
{
SplitPath, srcFileName,,, oExt
needle := "i)(?>(\.\w{2,4}))(?=.*\1)"
haystack := gSupportedExts . " ." . oExt
RegExMatch(haystack, needle, m)
return (m != "")
}
;################################################################################
getFilePath()
{
SendInput, ^c
Sleep, 100
fp := Clipboard ; convert to text path
return isZipFile(fp) ? fp : "" ; verify that it is a zip file
}
[/code]