OCR from simple screenshot gives unpredictable results


I'm trying to automate a copy/paste value in Apple Mainstage keyboard programming (the music type) software. Since Apple apparently haven't thought through their software design, it's not possible to copy/paste an essential value. I'm having no luck "taming" the OCR function with what I'd consider a simple task.

I've tried solving it with OCR Area-action using English language.

Screenshot 2022-01-17 at 00.39.25
Result stored in variable: "cicun en"

Screenshot 2022-01-17 at 00.39.13
Result stored in variable: "Transpose: v 12 ~"

Screenshot 2022-01-17 at 00.39.32
Result stored in variable: "ican ey"

Screenshot 2022-01-17 at 00.39.40
Result stored in variable: "ican ee"

"Transpose: 12" gives the only reasonable result, the rest is just... weird. Am I doing something wrong, or is the function still in beta?

I also tried isolating only the number. That returns even weirder results.


OCR is fairly limited, and really seems to struggle with white text on dark backgrounds.

You might be better off seeing if you can retrieve that information using GUI AppleScript instead.

If you’re unsure of how to do that let me know and I can explain it further.


Thank you for your response. I have used very little AppleScript, so any guide would be greatly appreciated.


Hey Andreas,

I don’t have that app so I can’t test anything or build any sample scripts, but if you have even basic AppleScript knowledge you can check out the app UI Browser which helps you identify things on the screen and how they can be accessed via AppleScript. It has a free trial (30 days I think) so you don’t have to worry about paying for it just to try it.

If you want to check it out it has a feature that allows you to hover your mouse over any object on the screen and see in real-time it’s AppleScript code. To give you an example:

This is the Inspector window in Preview:

And this AppleScript will get me the Image size information (namely 1024 x 1480 pixels):

tell application "System Events" to tell application process "Preview"
		get value of static text 6 of window "General Info"
end tell

So if MainStage is able to be accessed via this method, you would likely be able to get those numbers using something similar. The UI Browser app will give you the necessary information to write a basic script to accomplish this.

I imagine there's other folks on this forum that use that app too, so you might consider changing the title of your post to include the app's name that way others will see what you're working with. If you're not able to change the title, let me know and I can change it for you.


1 Like

Hello Chris,

Sorry the delayed response. Thank you for your tip, I will look into it. Very much appreciated!

All the best,

1 Like