OCR is Null or not an object

Thursday, October 4, 2012
Hi there!

I'm trying to set up a script which simply checks between two coordinates and returns the text displayed in that area.  The application I'm running against does not use standard Windows objects, so the only way to get values on the screen will be by OCR.  However, when I try to run one of the OCR commands, I get the message "'Ocr' is null or not an object."

The command I am running that leads to this error is:
SeS('KV2_Sim_Host_code_vi').Ocr.DoExtractFromScreen(39, 239, 114, 269);

My first thought is that I need to include the OCR library somewhere... is that with Ocr.DoSelectOcrEngine()?  After including that in the main test.js file, I was still getting the same issue.
2 Replies
Thursday, October 4, 2012
re: ymgagnon Thursday, October 4, 2012
Looks like I am simply running into issues with loading of the Tesseract engine.  I had a JS developer assist in troubleshooting, and came up with the message that the Tesseract engine is not installed.  (Also, in the command below, I was not correctly addressing the OCR.DoExtractFromScreen function, but that has been fixed.)

Now, I'm operating on the assumption that the OCR commands cannot be targeted to a specific window...?  Is there a way to specifically target the window I'm running an application in, or will I need it full-screened whenever I run this test?  (Fine either way... just hoping I could target specifically.)
Wednesday, October 17, 2012
re: ymgagnon Thursday, October 4, 2012

Hi Yves

I believe that the OCR engine can do both depending on which functions you use (DoExtractFromWindow() vs. DOExtractFromScreen())



Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885


  • Started: Thursday, October 4, 2012
  • Last Reply: Wednesday, October 17, 2012
  • Replies: 2
  • Views: 2885