OCR on Windows in FileMaker

Did you know that Windows 10 has a built-in OCR engine?

For MBS FileMaker Plugin 13.1 we add new WindowsOCR functions. These functions allow the plugin on Windows 10 to use the built-in OCR classes and expose them as functions to you in FileMaker. This was made possible by dropping Windows 7 support, so we can now use the functionality from Windows 8 to use these classes. Although if you call them on Windows 8, they will return an error. Please use WindowsOCR.Available in your script to check whether it returns 1.

Once you know you run on Windows 10 (or 11), you can check the available languages with WindowsOCR.AvailableRecognizerLanguages function. This function can return you the list of languages with either display name (in user's language), language tag or the name within the language itself. e.g. "German" vs. "Deutsch". You can use our WindowsOCR.CurrentInputMethodLanguageTag function to query what language the user has for the current method of input. The user may have multiple languages installed, but this one is used when you create a recognizer without specifying the language.

In your script you call WindowsOCR.New function to create a new recognizer and get the reference number for the recognizer object. You can create several recognizer for different languages in parallel and you may create them once and then keep them around until FileMaker quits. Various scripts may use them to recognize them. For server scripts, we recommend to make a new recognizer in a script and release it on the end of the script, so parallel running scripts don't try to touch the same one at the same time, which could lead to trouble.

Once you got the recognizer, you can let it recognize either images from a file or container. Pass a native file path to WindowsOCR.RecognizeFile or your container via variable or field to WindowsOCR.Recognize function. If it returns OK and no error, you can query the result. Both functions should do fine with various file formats like JPEG, TIFF, GIF, PNG, HEIF or BMP supported by Windows. The maximum size of such an image is 10000 by 10000 pixels.

After the recognition finished, you can query the text with WindowsOCR.Text function and the angle of that text with the WindowsOCR.TextAngle function. The WindowsOCR.Resultfunction returns you a JSON with all the details on the result including where individual words are located.

As we added the WindowsOCR functions, we also updated Vision.RecognizeText and Vision.SupportedRecognitionLanguages to work on Windows using these functions internally. So you have now one function similar to FIleMaker's LiveText function to recognize images on macOS, iOS and Windows. And since we worked with image functions from Windows, we implemented Container.ReadImage and Container.ReadImageFile functions on the way to read various images files like HEIF and convert them to JPEG or PNG.

Please try the new functions and don't hesitate to contact us with questions.

2 Likes