I've looked but didn't find an answer so if i've missed something point me in the right direction pls. And yes im new to this so all help is appreciated, and if there some wizard/preset for a variable position like this pls advise.
but here is the situation:
i have to find an image and click it. easy. coded and working.
however i have situations where i have 2 of the same image in the search area. and as they change positions its not possible to lets say find both and click the first one.
however there is an image next to each of them that can be used to determine which one to click.
Yes i know there is an option where you can click right/left/above/below and image with a preset offset. but the distance between image 1 and image 2 is not always exactly the same. and except in one scenario its not in a straight line more like down and to the right (which i guess you can solve by 2 move mouse commands one for each direction). but the variable distance is the problem factor.
so tried to do that by defining the search area based on the location of that unique image.
so basically search for Image 1
find its location
use that location to determine the search area of the Image 2 (that one we need to click)
Code: Select all
ScreenCapture>6,160,647,703,%TEMP_DIR%\screenrect.bmp
//Find and Do Nothing Top Left of
FindImagePos>%BMP_DIR%\image_1.bmp,%TEMP_DIR%\screenrect.bmp,0.7,0,XArr,YArr,NumFound,CCOEFF
**BREAKPOINT**
ScreenCapture>{%XArr_0%+6},{%YArr_0%+160},{%XArr_0%+435},{%YArr_0%+298},%TEMP_DIR%\screenrect.bmp
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_2.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>{%XArr_0%+159},{%YArr_0%+576}
LClick
Endif
so this was my attemtp to make that work:
Code: Select all
ScreenCapture>{%XArr_0%+6},{%YArr_0%+160},{%XArr_0%+435},{%YArr_0%+298},%TEMP_DIR%\screenrect.bmp
but here is where i run out of luck. and can't figure out how to solve
ثبت دامنه
Code: Select all
If>NumFound>0
MouseMove>{%XArr_0%+159},{%YArr_0%+576}
بلیط هواپیما but because the X,Y are not static and thus incorrect the mouse obviously moves to the wrong place.
so it should read something to the effect of:
Code: Select all
If>NumFound>0
MouseMove>{%XArr_0%+(old%XArr_0%+6) },{%YArr_0%+(old%XArr_0%+160)}
except i have no clue how to tell it to use the original XArr_0, from image 1 at this point.
thanks for the help