Posts: 11
Threads: 1
Joined: May 2015
Hello i want to search image on screen and if the image is found i want to move mouse curser 50mm to y axis from where the image is found so how can i do that ?
and how to store and use image from resources ?
Posts: 12,097
Threads: 142
Joined: Dec 2002
In "Find Image" dialog, capture the image and type r in "RECT variable for results" field. OK. It will save the image in macro resources. It will create code like this:
RECT r
int w=win("Firefox" "MozillaWindowClass")
scan "image:h90C1E21B" w r 2|16|128
Then add this line:
mou r.left r.top+50
Posts: 11
Threads: 1
Joined: May 2015
can you tell me where to find 'find image' and can you give me a example of any script that has same condition as mine
Posts: 12,097
Threads: 142
Joined: Dec 2002
Floating toolbar -> Windows, controls -> Find image, wait.
Macro Macro2541
RECT r
int w=win("Firefox" "MozillaWindowClass")
scan "image:h90C1E21B" w r 2|16|128
mou r.left r.top+50
Posts: 11
Threads: 1
Joined: May 2015
i written script but it is showing error that "Error (RT) in <open ":1: /0">Macro1: resource not found. "
Posts: 12,097
Threads: 142
Joined: Dec 2002
To transfer the resource I would need to export it or its macro to a file and attach to the post.
It is easy to create such code with the "Find Image" dialog. Don't need examples. This macro is just to show how the code should look. Don't run it.
Posts: 11
Threads: 1
Joined: May 2015
finding image and moving curser to it that is done but now how to move mouse curser 50mm to right and click
Posts: 12,097
Threads: 142
Joined: Dec 2002
Posts: 11
Threads: 1
Joined: May 2015
it is showing "Error in <open ":1: /39">Macro1: unknown identifier"
Posts: 12,097
Threads: 142
Joined: Dec 2002
or, if scan is without a RECT variable and with flag 1:
mou+ 50 0
lef
Posts: 12,097
Threads: 142
Joined: Dec 2002
Macro Macro2541
int w=win("Firefox" "MozillaWindowClass")
scan "image:h90C1E21B" w 0 1|2|16|128
mou+ 50 0
lef
Posts: 11
Threads: 1
Joined: May 2015
if image is found then go to step 45 otherwise go to step 80 how to do this ?
Posts: 12,097
Threads: 142
Joined: Dec 2002
In "Find Image" dialog uncheck "error if not found", then it will create code with if:
Macro Macro2544
int w=win("Firefox" "MozillaWindowClass")
if(scan("image:hEF1EB8D3" w 0 1|16))
,
Then add else, goto, and labels above steps 45 and 80:
Macro Macro2544
int w=win("Firefox" "MozillaWindowClass")
if(scan("image:hEF1EB8D3" w 0 1|16))
,out "found"
,goto step45
else
,out "not found"
,goto step80
;...
;step45
out "step45"
;...
;step80
out "step80"
Posts: 11
Threads: 1
Joined: May 2015
"Error in <open ":2: /177">Macro1: label not found" this is appearing and it is highlighting step45
Posts: 11
Threads: 1
Joined: May 2015
means how to use else if condition means if image found then do like this and if it is not found then do like this so how can i do this ?
Posts: 12,097
Threads: 142
Joined: Dec 2002
Macro Macro2544
int w=win("Firefox" "MozillaWindowClass")
if(scan("image:hEF1EB8D3" w 0 1|16))
,out "found"
,;add more code here,
,;the code must be tab-indented (or comma-indented, like in this example)
else
,out "not found"
,;add more code here,
,;the code must be tab-indented (or comma-indented, like in this example)
Posts: 11
Threads: 1
Joined: May 2015
if i write else but then also it is not performing else part things ?
Posts: 12,097
Threads: 142
Joined: Dec 2002
do you mean this?
Macro Macro2544
int w=win("Firefox" "MozillaWindowClass")
if(!scan("image:hEF1EB8D3" w 0 1|16))
,out "not found"
,;add more code here,
,;the code must be tab-indented (or comma-indented, like in this example)
;you can add more code here, it is executed always. Must not be tab-indented.
Posts: 11
Threads: 1
Joined: May 2015
Posts: 11
Threads: 1
Joined: May 2015
the else which is to run if image is not found that part is not working
|