【发布时间】:2016-08-17 11:38:18
【问题描述】:
我需要在 AHK 中找到一种方法来等待一个程序完成,然后再开始一个新程序。
基本上,我有一个脚本可以打开一个应用程序并输入一些参数。然后,应用程序会花费未知的时间来处理输入数据。
不幸的是,此时 ahk 脚本在应用程序完成处理之前结束,此时相同的 ahk 脚本再次运行并且不工作/中断先前的处理。
编辑:(在 Python 中使用子进程调用调用 ahk .exe)
有什么方法可以帮助解决这个问题吗?
供参考,脚本:
#NoEnv
CoordMode, Mouse, Window
SendInput Mode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
if 0 < 2 ; The left side of a non-expression if-statement is always the name of a variable.
{
MsgBox, This script requires 2 incoming parameters but it only received %0%.
ExitApp
}
IfWinNotExist, ahk_exe photoscan.exe
{
Run, "C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe"
}
sleep, 200
WinActivate, ahk_exe photoscan.exe
sleep,5
WinMaximize, ahk_exe photoscan.exe
;Macro5:
Click, 476, 438, 0
SendInput {LControl Down}
SendInput {r}
Click, -56, 157, 0
WinActivate, Run Python Script ahk_class QWidget
sleep, 400
SendInput {LControl Up}
SendInput {LControl Down}
SendInput {a}
SendInput {LControl Up}
sleep, 400
SendInput {Backspace}
SendInput %1% ; 1st argument is the photoScan API scriptimages folder directory
SendInput {Tab}
SendInput {Tab}
sleep, 400
SendInput {LControl Down}
SendInput {a} ; 2nd argument is additional args (in our case, the projectName)
SendInput {LControl Up}
SendInput {Backspace}
SendInput %2% ; 2nd argument is the images folder directory & name of output log, model and texture
Sleep, 703
SendInput {Enter}
Click, 476, 438, 0
Return
【问题讨论】:
-
这是什么语言?它肯定不是 Python。
-
AutoHotKey (AHK)。但它被 Python 中的 subprocess 模块调用。我链接了 Python,因为我不知道 Python 中是否有一些东西可以和 AHK 一样使用
标签: subprocess autohotkey