Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scan image in macro then compare to current screen
#1
Is there a way to d the following:
1. scan the window for a small image on the screen, if found, save a bitmap of the area area the position of the found image. for example if the mouse position of the found image is 200, 200 then I would save a larger area near this position, for example, top:100 bottom:300 left:100 right:300.

2. next wait 1 or 2 secs and compare this bitmap image that was saved and scan the screen for that image. If found, ok, if not found loop unit it is found.

So step 2 is easy and I know how to manage that piece. But i'm not sure how to save the bitmap of the larger area in step one.
#2
Macro Macro2901
Code:
Copy      Help
;step 1 - find small image and capture/save bigger image that is around the found rectangle.

;find small image. Code created with the 'Find image' dialog.
RECT r
int w=win("Firefox" "MozillaWindowClass")
scan "image:h9879DFA1" w r 2|16|128
;resize the found rectangle
InflateRect &r 100 100 ;;instead you can simply adjust r like r.left-100; r.right+100...
;capture screen and save in bmp file
str bmpFile="$temp$\159.bmp"
if(!CaptureImageOnScreen(r.left r.top r.right-r.left r.bottom-r.top bmpFile)) end "failed"

;results
run bmpFile


Forum Jump:


Users browsing this thread: 1 Guest(s)