自动热键:运行后消息框"Done"



我有一个 python 脚本,我想在快捷键上运行,但我希望 Msgbox 告诉我它完成后就完成了。我该怎么做?

我试过把MsgBox, Done放在不同的地方,这样

F8::Runwait, C:python36python.exe  "C:UsersjasonGoogle Drivepycharmtest.py"; 
MsgBox, Done
F9::Run, C:python36python.exe  "C:UsersjasonGoogle Drivepycharmtest1.py"; 
MsgBox, Done1

在文档的RunMsgBox部分中没有看到任何示例。

想要执行任何热键后的"完成"。

你能只使用RunWait而不是Run让程序等待脚本完成再继续吗? 如果您希望执行多行,还需要使用多行热键语法。 以下是脚本的编辑版本:

F8::
RunWait, C:python36python.exe  "C:UsersjasonGoogle Drivepycharmtest.py"; 
MsgBox, Done
Return
F9::
RunWait, C:python36python.exe  "C:UsersjasonGoogle Drivepycharmtest1.py"; 
MsgBox, Done1
Return

请注意,如果您的 python 脚本启动另一个进程,您的 AutoHotkey 脚本将不会等待第二个进程。

要让热键执行多个命令,请将第一行放在热键定义下方,并使最后一行返回:

F8::
Runwait, C:python36python.exe  "C:UsersjasonGoogle Drivepycharmtest.py"; 
MsgBox, Done
return

https://www.autohotkey.com/docs/Hotkeys.htm#Intro

最新更新