Thanks a lot for that. Apple's documentation doesn't mention any of these properties :-(
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Latest posts made by chrillek
-
RE: Recognize text from picture
-
RE: Recognize text from picture
Does string not work?
It does, but only in a very convoluted way, like so:
results.forEach(r => { console.log(r.topCandidates(1).js[0].string.js) })
The
js
in the middle is required to convert the ObjC array returned bytopCandidates
to a JavaScript array (and again to convert the NSString returned bystring
to a JS string). But usingstring
directly atr
does not work.we just poke around using autocomplete
I gues that happens in XCode (the poking around)?
-
RE: Recognize text from picture
Hi,
I'm aware that this thread is about a year old. But maybe someone can nevertheless alighten me. I'm trying to do a similar thing in JavaScript for Automation (JXA), and I see this line in your example:for result in req.results(): print(result.text())
translated to JavaScript, that's
results.forEach(r => { console.log(r.text); })
and that works like a charm. I'm just wondering why, since according to Apple's documentation, the
results
object doesn't even have atext
property, onlystring
(cf. https://developer.apple.com/documentation/vision/vnrecognizedtext?language=objc)I was first wondering if
text
is perhaps a nice Python thing, but since the same works in JavaScript, I'm sure that I'm missing something obvious in Apple's documentation. Does anyone know what (and where I should be looking)?Thanks a lot in advance
Christian