hi
is it possible to look for a part of the screen and then within that part click on a button.
example
//Look for Image_A using the entire screen
FindImagePos>c:\Image_A.bmp,SCREEN,0.7,1,X,Y,NumFound,CCOEFF
If>NumFound>0
MouseMove>X_0,Y_0
//If Image_A is found look for Image_B within Image_A and Click on Image_B
FindImagePos>c:\Image_B.bmp,c:\Image_A.bmp,0.7,1,X,Y,NumFound,CCOEFF
If>NumFound>0
MouseMove>X_0,Y_0
LClick
EndIf
Else
wait>0.5
EndIf
any help would be appreciated.
Looking for an Image within an Image
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Looking for an Image within an Image
Yes. You can look within an existing image file, or use ScreenCapture to capture a portion of the screen and then look within that. Just remember to calculate your offsets to get the mouse coordinates right. I.e. if you are looking in an image which represents part of the screen starting at position 100,150 then you'll need to add 100 and 150 to your X and Y positions of the match in order to get back to screen positions for your mouse click.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Looking for an Image within an Image
thanks for the reply marcus
the one issue i have is that the, the position of the images change every time IE is refreshed.
so i can't set any coordinates. is there a work around this.
thanks
the one issue i have is that the, the position of the images change every time IE is refreshed.
so i can't set any coordinates. is there a work around this.
thanks
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Looking for an Image within an Image
The whole point of image recognition is that you don't need to know where something is - it's purpose is to TELL you by finding it.
So perhaps I don't really understand what you are trying to accomplish. If you want to capture a portion of the screen and then look WITHIN that portion you need to be able to define that portion first. Maybe you'd do that with image recognition first?
What is the reason for only wanting to look in a specific portion? Scanning the entire screen is very fast and you can also specify just a window - e.g. the internet explorer window.
So perhaps I don't really understand what you are trying to accomplish. If you want to capture a portion of the screen and then look WITHIN that portion you need to be able to define that portion first. Maybe you'd do that with image recognition first?
What is the reason for only wanting to look in a specific portion? Scanning the entire screen is very fast and you can also specify just a window - e.g. the internet explorer window.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Looking for an Image within an Image
here is what i am trying to do.
am trying to answer question 2 and question 3. the questions are different but the multiple choice answers are the same
bellow is an image of the correct answers what ends up happening is that the mouse click for question 2's answer is being clicked on the answer list for question 3.
question 2 & answers = Image_A
answer for question 2 = Image_B
look for Image_A in the SCREEN
if Image_A is found
look for Image_B in Image_A
and click on Image_B
question 3 & answers = Image_C
answer for question 3 = Image_D
look for Image_C in the SCREEN
if Image_C is found
look for Image_D in Image_C
and click on Image_D
i hope this makes sense
am trying to answer question 2 and question 3. the questions are different but the multiple choice answers are the same
bellow is an image of the correct answers what ends up happening is that the mouse click for question 2's answer is being clicked on the answer list for question 3.
question 2 & answers = Image_A
answer for question 2 = Image_B
look for Image_A in the SCREEN
if Image_A is found
look for Image_B in Image_A
and click on Image_B
question 3 & answers = Image_C
answer for question 3 = Image_D
look for Image_C in the SCREEN
if Image_C is found
look for Image_D in Image_C
and click on Image_D
i hope this makes sense
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Looking for an Image within an Image
Use EXACT matching. You will then get an array of ALL matches on the screen and can then loop through the array and click each one.
The default CCOEFF method only returns one match - the most statistically likely. So it will be only one of them.
The default CCOEFF method only returns one match - the most statistically likely. So it will be only one of them.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?