If Image Is Not Found

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
mokshal1663
Junior Coder
Posts: 33
Joined: Sat Feb 27, 2010 8:11 pm

If Image Is Not Found

Post by mokshal1663 » Sat Feb 27, 2010 9:18 pm

I want to do something if an image is found. If it is not found, I want it to look for another image. And if that image is not found, I want it to look for another image which is defiantly there and click it, then display an error message. My code is this, how can I make it do what I want:

FindImagePos>C:\Documents and Settings\mokshal\MyDocuments\noted.bmp,SCREEN,0,1,X,Y,Note
MouseMove>X_0,Y_0
LClick

Thanks

mokshal1663
Junior Coder
Posts: 33
Joined: Sat Feb 27, 2010 8:11 pm

Dead?

Post by mokshal1663 » Sun Feb 28, 2010 12:58 am

Is this forum dead?

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Mon Mar 01, 2010 5:24 am

Hi mokshal1663,

Sometimes it is a little sleepy over the weekend.

The last parameter of the FindImagePosition command returns the number of images found.

Code: Select all

Let>docdir=C:\Documents and Settings\mokshal\MyDocuments
FindImagePos>%docdir%\noted.bmp,SCREEN,0,1,X,Y,Note
if>Note>0 
  MouseMove>X_0,Y_0 
  LClick
else
  FindImagePos>%docdir%\noted2.bmp,SCREEN,0,1,X,Y,Note
  if>Note>0
    MouseMove>X_0,Y_0 
    LClick
  else
    FindImagePos>%docdir%\error.bmp,SCREEN,0,1,X,Y,Error
    if>Error>0
      MouseMove>X_0,Y_0 
      LClick
      //put code to read the error message here
      //or do a screencapture to display it graphically
    else
      MDL>Can't find the error message
    endif
  endif
endif
I have not tested this, but hope it gives you the idea.

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

Re: Dead?

Post by Marcus Tettmar » Mon Mar 01, 2010 10:20 am

mokshal1663 wrote:Is this forum dead?
No, the forum is NOT dead - you're getting a response ONE day after you posted a message on a SUNDAY. Get real and please don't hijack threads. It is counter productive and more likely to delay responses.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mokshal1663
Junior Coder
Posts: 33
Joined: Sat Feb 27, 2010 8:11 pm

Re: Dead?

Post by mokshal1663 » Mon Mar 01, 2010 12:15 pm

mtettmar wrote:
mokshal1663 wrote:Is this forum dead?
No, the forum is NOT dead - you're getting a response ONE day after you posted a message on a SUNDAY. Get real and please don't hijack threads. It is counter productive and more likely to delay responses.
Sorry, I was just frustrated and couldn't think straight.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Mon Mar 01, 2010 3:15 pm

You may also find my Tolerance Tester useful:

http://www.mjtnet.com/forum/viewtopic.php?t=5913

I am just doing a little work on this right now to make it a bit more useful.

EDIT: Update is done.
Phil Pendlebury - Linktree

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