下面的AHK脚本应该使用7-zip来解压ctrl+ALT+Left时的文件夹.当您手动右键单击一个文件夹,然后键入"7eee“,然后按enter,该文件夹将提取。我想模仿这个没有右键点击,而是使用键盘快捷键。我试着用两种方法:
;alt + ctrl
!^LButton::
blockinput on
send {LButton}{RButton}7eee{enter}
blockinput Off
return
我也试过:
;alt + ctrl
!^LButton::
temp = %clipboard%
KeyWait, LButton, D
send {LButton}
sleep,100
Send, {Ctrl Down}c{Ctrl Up}
file = %clipboard% ;get file address
clipboard = %temp% ;restore clipboard
outdir := getdir(file)
if (A_Is64bitOS = 1)
{
runwait, "C:\Program Files\7-Zip\7z.exe" x "%file%" -o"%outdir%" -y,,hide
}
else
{
runwait, "C:\Program Files (x86)\7-Zip\7z.exe" x "%file%" -o"%outdir%" -y,,hide
}
msgbox, 7zip has finished extracting "%file%".
return
getdir(input)
{
SplitPath, input,,parentdir,,filenoext
final = %parentdir%\%filenoext%
return final
}
编辑:
我发现一些有用的东西:
#IfWinActive, AHK_EXE Explorer.exe
^e::
temp = %clipboard%
Send, {Ctrl Down}c{Ctrl Up}
file = %clipboard% ;get file address
clipboard = %temp% ;restore clipboard
outdir := getdir(file)
if (A_Is64bitOS = 1)
{
runwait, "C:\Program Files\7-Zip\7z.exe" x "%file%" -o"%outdir%" -y,,hide
}
else
{
runwait, "C:\Program Files (x86)\7-Zip\7z.exe" x "%file%" -o"%outdir%" -y,,hide
}
msgbox, 7zip has finished extracting "%file%".
return
getdir(input)
{
SplitPath, input,,parentdir,,filenoext
final = %parentdir%\%filenoext%
return final
}
#If
但我不喜欢这个信息框,我希望有一个进度条或指示它正在提取过程中。
发布于 2022-09-26 23:28:57
这是一个老问题,您可能对已经找到的解决方法没有意见,但是如果您仍然在寻找一个模仿鼠标/键盘过程的简单脚本,下面是:
^#!z:: ;// Ctrl + Alt + Win + Z
blockinput on
Sleep, 300
SendInput, {AppsKey}
Sleep, 100
SendInput, 7
Sleep, 100
SendInput, e
Sleep, 100
SendInput, e
Sleep, 100
SendInput, e
Sleep, 100
SendInput, {Enter}
blockinput on
Return
我没有尝试过您的代码,但一般来说,使用上下文菜单键(AppKey)比单击鼠标按钮更可靠,并且在按键之间添加一些睡眠时间也会有所帮助。如果脚本不工作,您可能需要增加睡眠时间间隔,每次100 ms,直到它工作为止。
https://stackoverflow.com/questions/63055617
复制相似问题