How do I get ImageSearch to do another search? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kusokamisama
Posts: 5
Joined: 14 Jan 2018, 07:08

How do I get ImageSearch to do another search?

14 Jan 2018, 07:25

Hi, I need to code the following steps:
1. Find first image
2. Left click
3. Find a second image (this is where the problem is, the code does not continue after the first "Left click")
4. Left click

Code: Select all

^3::


   ImageSearch,,,912, 31, 1326, 767, C:\Users\Kami\Desktop\script\homescreen.png
if ErrorLevel = 2homescreen.png
    MsgBox error with finding homescreen.png
else if ErrorLevel = 1
   Loop {
       ImageSearch,,, 912, 31, 1326, 767, C:\Users\Kami\Desktop\script\homescreen.png
   } Until ErrorLevel = 0
   Click, 208, 610


   ImageSearch,,, 912, 31, 1326, 767, C:\Users\Kami\Desktop\script\pickmode.png
if ErrorLevel = 2
    MsgBox error with finding pickquest.png
else if ErrorLevel = 1
   Loop {
       ImageSearch,,, 912, 31, 1326, 767, C:\Users\Kami\Desktop\script\pickmode.png
   } Until ErrorLevel = 0
   Click 213, 363
       
       
Return
The first Image Search works perfectly fine and a "Left click" is executed after the image is found
However, the script does not execute the second ImageSearch and the script just stops

Please help me, Thank You
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: How do I get ImageSearch to do another search?  Topic is solved

14 Jan 2018, 09:22

Are you sure the code stopped and is not in the second loop? Try with a tooltip that gives the loop count to be sure.
Be aware that you are using coordinates relative to the active window , if the first click changes the active window ....well as a kami sama you should know what happens next !

example with tooltip :

Code: Select all

; CoordMode, pixel  ; if you have screencoordinates and not relative to active window

^3::
   ImageSearch,,,912, 31, 1326, 767, C:\Users\Kami\Desktop\script\homescreen.png
if ErrorLevel = 2
    MsgBox error with finding homescreen.png
else if ErrorLevel = 1
   Loop {
       ImageSearch,,, 912, 31, 1326, 767, C:\Users\Kami\Desktop\script\homescreen.png
   } Until ErrorLevel = 0
   Click, 208, 610


   ImageSearch,,, 912, 31, 1326, 767, C:\Users\Kami\Desktop\script\pickmode.png
if ErrorLevel = 2
    MsgBox error with finding pickmode.png
else if ErrorLevel = 1
   Loop {
   tooltip % A_Index
       ImageSearch,,, 912, 31, 1326, 767, C:\Users\Kami\Desktop\script\pickmode.png
   } Until ErrorLevel = 0
   Click 213, 363
   
Return
kusokamisama
Posts: 5
Joined: 14 Jan 2018, 07:08

Re: How do I get ImageSearch to do another search?

15 Jan 2018, 04:01

Thanks noname, I'm a failure as a kami sama.

Anyway, it's Coordmode that my script was missing. I've figured everything out now and it works perfectly, Thanks a lot!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: aitaixy, Anput, dangoscrub, doodles333, joedf, Nerafius and 108 guests