首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我有一个使用7-zip提取文件夹的AHK脚本。为什么不起作用?

我有一个使用7-zip提取文件夹的AHK脚本。为什么不起作用?
EN

Stack Overflow用户
提问于 2020-07-23 13:36:37
回答 1查看 364关注 0票数 0

下面的AHK脚本应该使用7-zip来解压ctrl+ALT+Left时的文件夹.当您手动右键单击一个文件夹,然后键入"7eee“,然后按enter,该文件夹将提取。我想模仿这个没有右键点击,而是使用键盘快捷键。我试着用两种方法:

代码语言:javascript
运行
复制
;alt + ctrl
!^LButton::
blockinput on
send {LButton}{RButton}7eee{enter}
blockinput Off
return

我也试过:

代码语言:javascript
运行
复制
;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
} 

编辑:

我发现一些有用的东西:

代码语言:javascript
运行
复制
#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

但我不喜欢这个信息框,我希望有一个进度条或指示它正在提取过程中。

EN

Stack Overflow用户

发布于 2022-09-26 23:28:57

这是一个老问题,您可能对已经找到的解决方法没有意见,但是如果您仍然在寻找一个模仿鼠标/键盘过程的简单脚本,下面是:

代码语言:javascript
运行
复制
^#!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,直到它工作为止。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63055617

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档