Forum Discussion

ahmed_galal_1's avatar
ahmed_galal_1
Occasional Contributor
12 years ago

How to force Region CheckPoint to return False without throwing an Error?

Hi All,



I would like to ask a question regarding Region CheckPoin, How to force Region CheckPoint to return False without throwing an Error?



I want to just return true or false from a function that compare two Image



My Code in JaveScript:



Function CompareFunction (ImageObj)

{

  var CompareResult = Region.MyImage.Check(ImageObj);

  if (CompareResult)

  {

     return true;

  }

  else

  {

     return false;

  }

}





Regards,





1 Reply

  • Hi Ahmed.



    You should take a look at the Compare Method.



    The Check method will post a message to the log, while the Compare will return null or a rectangle. 



    And by the way, no need to do :

    if(CompareResult) {

      return true;

    }  else {

      return false;

    }



    You whould return CompareResult != null.



    Guillaume