scan image in macro then compare to current screen

Creating complex macros, dialogs, solving complex tasks, programming.

scan image in macro then compare to current screen

Postby jps01 on Sun Aug 06, 2017 12:40 am

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.
jps01
 
Posts: 24
Joined: Thu Jan 08, 2015 1:37 pm

Re: scan image in macro then compare to current screen

Postby Gintaras on Sun Aug 06, 2017 6:50 am

Macro Macro2901     ?
;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

Gintaras
Site Admin
 
Posts: 10298
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron