A simple "Do if find image"

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
fixito13
Newbie
Posts: 2
Joined: Thu Aug 16, 2018 3:54 pm

A simple "Do if find image"

Post by fixito13 » Thu Aug 16, 2018 4:02 pm

Good afternoon
I was trying to make a macro that when it finds an image on one of the pages opened it would click a specific point in the screen. And if it didn't find the image to continue to make LAlt + Tab but i can't figure out how to do It.

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: A simple "Do if find image"

Post by Marcus Tettmar » Thu Aug 16, 2018 5:24 pm

Try the image recognition wizard. It creates exactly that kind of code for you.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

fixito13
Newbie
Posts: 2
Joined: Thu Aug 16, 2018 3:54 pm

Re: A simple "Do if find image"

Post by fixito13 » Thu Aug 16, 2018 6:25 pm

WaitScreenImage>C:\Users\mcorr\Desktop\Sem Título.bmp,0.7,CCOEFF
This is what I get. I wanted to make something like an If so if the image was detected It would click on a spot. But if the image wasn't detected it would press LALT + TAB

This is what I got until now.
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
Repeat
Press LALT
Press TAB
Let>WSI_TIMEOUT=1
//Wait for
WaitScreenImage>C:\Users\mcorr\Desktop\Sem Título.bmp,0.7,CCOEFF
If
Until>

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: A simple "Do if find image"

Post by Marcus Tettmar » Thu Aug 16, 2018 11:31 pm

Use FindImagePos. If using the wizard use the FIRST option - to FIND position of image. That returns the position of the image and adds code to click on it ...
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts