脚本不会 运行 一段代码
script won't run a section of code
我有这个小脚本,可以打开一个应用程序并输入一些字母。但是,出于某种原因,脚本不会 运行 一段代码。它达到 winMaximize 然后停止。但是,如果该应用程序已经打开,那么该部分 运行??不确定我是否做错了什么,想法?
#NoEnv
CoordMode, Mouse, Window
SendMode 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
{
RunWait, "C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe"
}
WinActivate ; Automatically uses the window found above.
sleep,5
WinMaximize
;Macro5:
Click, 499, 426, 0
Click, 497, 427, 0
Click, 496, 427, 0
Click, 493, 428, 0
Click, 492, 429, 0
Click, 487, 431, 0
Click, 485, 433, 0
Click, 482, 435, 0
Click, 481, 435, 0
Click, 480, 435, 0
Click, 479, 436, 0
Click, 478, 436, 0
Click, 477, 437, 0
Click, 477, 438, 0
Click, 476, 438, 0
Send, {LControl Down}
Send, {r}
Click, -56, 157, 0
WinActivate, Run Python Script ahk_class QWidget
Send, {LControl Up}
Send, {LControl Down}
Send, {LControl Up}
Send, {LControl Down}
Send, {a}
Send, {LControl Up}
Send, {Backspace}
Send, {%1%} ; 1st argument is the images folder directory
Send, {Tab}
Send, {Tab}
Send, {LControl Down}
Send, {%2%} ; 2nd argument is additional args (in our case, the projectName)
Send, {LControl Up}
Send, {Backspace}
Send, {b}
Sleep, 703
Send, {Enter}
Click, 476, 438, 0
Return
通过省略任何 wintitle
参数,您将在 "The Last Found Window" 上调用 winactivate
和 winmaximize
。我认为 winMaximize 根本没有执行,因为没有找到 window(它被称为 "the last found window",而不是 "the window which was found last, or maybe it wasn't")。
Afaican 看到,你的堆栈跟踪是
>
> IfWinNotExist, ahk_exe photoscan.exe ; does not exist. -> last found window: NONE
> RunWait, "C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe"
> ; still: last found window: NONE
> WinActivate / WinMaximize ; called on NONE
不确定为什么 winActivate
终止。无论哪种方式,如果您将 ahk_exe photoscan.exe
添加到 winactivate 和 winmaximize,您应该没问题
我有这个小脚本,可以打开一个应用程序并输入一些字母。但是,出于某种原因,脚本不会 运行 一段代码。它达到 winMaximize 然后停止。但是,如果该应用程序已经打开,那么该部分 运行??不确定我是否做错了什么,想法?
#NoEnv
CoordMode, Mouse, Window
SendMode 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
{
RunWait, "C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe"
}
WinActivate ; Automatically uses the window found above.
sleep,5
WinMaximize
;Macro5:
Click, 499, 426, 0
Click, 497, 427, 0
Click, 496, 427, 0
Click, 493, 428, 0
Click, 492, 429, 0
Click, 487, 431, 0
Click, 485, 433, 0
Click, 482, 435, 0
Click, 481, 435, 0
Click, 480, 435, 0
Click, 479, 436, 0
Click, 478, 436, 0
Click, 477, 437, 0
Click, 477, 438, 0
Click, 476, 438, 0
Send, {LControl Down}
Send, {r}
Click, -56, 157, 0
WinActivate, Run Python Script ahk_class QWidget
Send, {LControl Up}
Send, {LControl Down}
Send, {LControl Up}
Send, {LControl Down}
Send, {a}
Send, {LControl Up}
Send, {Backspace}
Send, {%1%} ; 1st argument is the images folder directory
Send, {Tab}
Send, {Tab}
Send, {LControl Down}
Send, {%2%} ; 2nd argument is additional args (in our case, the projectName)
Send, {LControl Up}
Send, {Backspace}
Send, {b}
Sleep, 703
Send, {Enter}
Click, 476, 438, 0
Return
通过省略任何 wintitle
参数,您将在 "The Last Found Window" 上调用 winactivate
和 winmaximize
。我认为 winMaximize 根本没有执行,因为没有找到 window(它被称为 "the last found window",而不是 "the window which was found last, or maybe it wasn't")。
Afaican 看到,你的堆栈跟踪是
>
> IfWinNotExist, ahk_exe photoscan.exe ; does not exist. -> last found window: NONE
> RunWait, "C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe"
> ; still: last found window: NONE
> WinActivate / WinMaximize ; called on NONE
不确定为什么 winActivate
终止。无论哪种方式,如果您将 ahk_exe photoscan.exe
添加到 winactivate 和 winmaximize,您应该没问题