2016-04-22 13 views
1

Ich habe dieses kleine Skript, das eine App öffnen und ein paar Buchstaben eingeben soll. Aus irgendeinem Grund wird das Skript jedoch keinen Codeabschnitt ausführen. Es steht auf winMaximize und stoppt dann. Aber wenn die App schon geöffnet ist dann läuft der Abschnitt ?? Nicht sicher, ob ich etwas falsch mache, Ideen?Skript wird nicht einen Abschnitt des Codes ausführen

#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 

Antwort

2

von ommitting alle wintitle Parameter, Sie winactivate und winmaximize auf der "The Last Found Window" anrufen. Ich denke, dass winMaximize einfach nicht ausgeführt wird, weil es kein gefundenes Fenster gab (es heißt "das zuletzt gefundene Fenster" und nicht "das Fenster, das zuletzt gefunden wurde, oder vielleicht auch nicht").

Afaican sehen, Ihr Stack-Trace ist

> 
> 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 

nicht sicher, warum winActivate obwohl beendet. So oder so, wenn Sie hinzufügen ahk_exe photoscan.exe zu winactivate und winmaximize, sollten Sie in Ordnung sein