autohotkey - 我有一个使用 7-zip 提取文件夹的 AHK 脚本。为什么它不起作用?
问题描述
当按下 ctrl+ALT+Left 时,下面的 AHK 脚本应使用 7-zip 解压文件夹。当您手动右键单击文件夹然后键入“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
但我不喜欢消息框,我希望有一个进度条或指示它正在提取过程中。
解决方案
推荐阅读
- javascript - 使用javascript将html表转换为带有数字的二维数组
- swift - SwiftUI TextField (MacOS) 的奇怪行为
- r - 贝叶斯逻辑回归
- javascript - 递归乘法函数
- r - R dplyr: select all columns after transforming selected columns
- reactjs - 在redux中调度动作的延迟
- node.js - axios 发出一个空请求,然后发出正确的请求
- c++ - 模板化基类的 C++ 函数模板特化
- c# - 如何循环遍历层次结构中的所有游戏对象,包括两个场景中的禁用对象所有子对象?
- selenium - 在 AWS 上运行 scrapy/selenium 脚本有意义吗?