Browse Source

fix test script image search

Eren Yilmaz 6 years ago
parent
commit
92298a9935
1 changed files with 6 additions and 2 deletions
  1. 6 2
      test.ahk

+ 6 - 2
test.ahk

@@ -20,14 +20,14 @@ Run, %ApplicationPath%, %ApplicationDir%
 FindImg(Image, ByRef X, ByRef Y, MaxTries)
 {
     global ImgDir
-    WinGetPos, _, _, WindowWidth, WindowHeight
     loop {
         Sleep, 1000
         file := ImgDir "\" Image
+        WinGetPos, WinX, WinY, WindowWidth, WindowHeight, A
         ImageSearch, X, Y, 0, 0, %WindowWidth%, %WindowHeight%, *5 %file%
         ifEqual, ErrorLevel, 2
         {
-            log("Could not conduct the search for " file 0 0 WindowWidth WindowHeight)
+            log("Could not conduct the search for " file)
             return False
         } else ifEqual, ErrorLevel, 1
         {
@@ -44,6 +44,7 @@ FindImg(Image, ByRef X, ByRef Y, MaxTries)
 }
 
 ; Main Program
+log("waiting for Kolja-Strohm Games Patcher")
 If (not WinWaitActive Kolja-Strohm Games Patcher,,30)
 {
     log("Kolja-Strohm Games Patcher is not active after 30 seconds")
@@ -51,9 +52,12 @@ If (not WinWaitActive Kolja-Strohm Games Patcher,,30)
 }
 
 Sleep, 1000
+log("searching for play button")
 if (FindImg("play.bmp", X, Y, 60))
 {
     log("Patching successful")
+} else {
+    ErrorExit()
 }
 CleanUp()