Some while ago I wrote this post about how to script a tool called Textract to perform OCR against the screen. Well gpulawski has just posted this tip in the forums pointing out that Microsoft Office 2003/2007 comes with something called MODI (Microsoft Office Document Imaging) which can OCR a bitmap or TIFF file and is scriptable. Very cool.
We can use MODI transparently in a Macro Scheduler script to use OCR to extract text from a Window. I’ve posted an example here.
This is really useful if you have a window that doesn’t expose text as text objects and you can’t get at the text any other way (e.g. via the clipboard or controls). You may want to check for the existence of a certain string in a window, or wait for a particular word or phrase to appear in order to determine when a process has completed. If the control doesn’t expose the text and the text cannot be copied to the clipboard, OCR may be the solution.