简体   繁体   English

macOS:如何从 AppleScript/JXA 访问实时文本 OCR 功能?

[英]macOS: How to access the Live Text OCR functionality from AppleScript/JXA?

As of macOS Monterey it is possible to select text in images in Preview.从 macOS Monterey 开始,可以在预览中选择图像中的文本。

Is this OCR functionality available from AppleScript and/or JXA (JavaScript for Automation)? AppleScript 和/或 JXA(用于自动化的 JavaScript)是否提供此 OCR 功能?

在此处输入图像描述

In Script Editor.app File > Open dictionary... I selected the Preview.app and looked at the API for Standard Suite and Text Suite but there doesn't seem to be anything related to OCR.Script Editor.app File > Open dictionary...我选择了Preview.app并查看了Standard SuiteText Suite的 API,但似乎没有任何与 OCR 相关的内容。 (The Text Suite apparently has to do with drawing text on picture and not text extraction.) 文本套件显然与在图片上绘制文本而不是文本提取有关。)

I have also searched for text recognition actions in Automator.app but didn't see anything suitable.我还在 Automator.app 中搜索了文本识别操作,但没有看到任何合适的内容。

There isn't (yet?) a way to directly access OCR from AppleScript, but the workaround that I'm using is to use OwlOCR .没有(还没有?)从 AppleScript 直接访问 OCR 的方法,但我正在使用的解决方法是使用OwlOCR This is an app that can capture text from the screen and output it to PDF, or plant text to the clipboard.这是一款可以从屏幕上捕获文本并将其输出为 PDF 或将文本植入剪贴板的应用程序。 Crucially for our purposes, it can also be controlled from the command line , and you can wrap those shell commands in an AppleScript “do shell script” command.对我们来说至关重要的是,它还可以 从命令行进行控制,您可以将这些 shell 命令包装在 AppleScript “do shell script”命令中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在macOS上从JXA / JavaScript for Automation脚本运行内联Applescript? - How do you run inline Applescript from a JXA/JavaScript for Automation script on macOS? JXA / Applescript +页面:从模板创建文档 - JXA/Applescript + Pages: Create Document from template 如何从Applescript访问文本服务? - How to access a text service from an Applescript? 使用 javascript (JXA) 而不是 applescript 处理来自 mac 的电子邮件 - Process emails from mac using javascript (JXA) instead of applescript 如何从强化的 macOS 应用程序运行系统事件 AppleScript? - How to run a system event AppleScript from a hardened macOS app? 如何从JXA中的对象获取多个属性? - How to get multiple properties from objects in JXA? 通过(JXA / AppleScript)从Chrome中当前网页的内部功能获取值 - Getting values from inner functions of current webpage in Chrome via (JXA / AppleScript) 无法通过 Applescript 或 JXA 删除照片中的子文件夹? - Delete Subfolders in Photos via Applescript or JXA not possible? 使用 AppleScript 将单个照片标题从 MacOS 照片应用程序导出到文本文件 - Using AppleScript to export individual photo titles to text file from MacOS Photos App 在.app运行时触发脚本(AppleScript或JXA)? - Trigger a script (AppleScript or JXA) on .app running?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM