Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scan - question?
#1
Greetings,

I've read the scan help a few times and hope my eyes didn't miss this...

Which way does it scan across the screen? Top (left to right), down, repeat?

I want to try and minimise the scan to a tall thin area where the image might appear several times. Ideally I would like to loop actions each time it is found until its not and then continue rest of macro (but that is beyond me for now).

Thanks
#2
Macro Macro2
Code:
Copy      Help
;Find picture in specified rectangle region, and get its location:
RECT r; r.left=100; r.top=100; r.right=300; r.bottom=300
;retry
if(scan("test.bmp" 0 r))
,out "x=%i y=%i width=%i height=%i" r.left r.top r.right-r.left r.bottom-r.top
else
,goto retry
#3
Quote:Which way does it scan across the screen? Top (left to right), down, repeat?
It reads screen in the same direction like you read English text. If with waiting, does it repeatedly.

Quote:to loop actions each time it is found until its not
In "Find Image" dialog select "Wait until disappears".

QM_Expert showed how to set the rectangle. If the rectangle size exactly matches bitmap size, then scan does not search but just compares the area with the bitmap.
#4
Thanks for the info guys!

I won't be able to set it to wait for it to disappear as when it finds it other actions will be made on other screens (unless I can loop it all). It will then return to the window and locate the image again (if its there), if not continue to other instruction.

Thanks again
#5
Then code can be similar to QM_Expert's.

Macro Macro1534
Code:
Copy      Help
RECT r; r.left=100; r.top=100; r.right=300; r.bottom=300
rep
,if(!scan("test.bmp" 0 r))
,,break ;;exit loop when not found
,;found
,out "x=%i y=%i width=%i height=%i" r.left r.top r.right-r.left r.bottom-r.top
,;...
,0.5 ;;wait


Forum Jump:


Users browsing this thread: 1 Guest(s)