3 ms·
There was once an API for an instrument, I believe using COM, that was primarily designed to build an interface with. It had very limited actual functionality t
by bmitc 3y ago
There was once an API for an instrument, I believe using COM, that was primarily designed to build an interface with. It had very limited actual functionality to get data from the API, whereas most data was simply to be displayed on user interface elements. We needed a piece of data, programmatically to do something with, that was only available via a user interface element. So I wrote and trained a vision application that would OCR the numeric indicator by taking a programmatic screenshot of the user interface element and then return the value. So at the top level, one simply made a function call that returned a number, but below, it was doing the UI display (hidden), screenshotting a region of the hidden window, OCRing it, and then returning the number.
You'd be surprised at the hacks required when interacting with scientific instrumentation. I am not a hacker at heart, but I do take pride when I'm able to wrap a hack such that you'd never know what it was doing underneath. Leaky hacks are no fun.