[英]Run Applescript on selected text and store it on clipboard
I'm looking for a solution to be able to select a text on an app(Figma) and then reverse it then store reverse version to the clipboard. 我正在寻找一种解决方案,能够在应用程序(Figma)上选择文本,然后将其反转,然后将反向版本存储到剪贴板。 I used BetterTouchBar app for saving selected text but I can't do anything with it.
我使用BetterTouchBar应用程序来保存所选文本但我无法用它做任何事情。
How can I do that with or without BetterTouchbar App. 无论是否使用BetterTouchbar App,我该怎么做?
Thanks a lot. 非常感谢。
Create an Automator Quick Action 1 , setting Workflow receives current text in any application and add a Run AppleScript action , adding the following line of example AppleScript code where is says: (* Your script goes here *) 创建Automator 快速操作 1 ,设置工作流在任何应用程序中接收当前文本并添加运行AppleScript 操作 ,添加以下示例 AppleScript 代码行,其中: (*您的脚本在此处*)
set the clipboard to the (reverse of characters of item 1 of input) as text
Save the Quick Action as eg: Reverse Selected Text To Clipboard 将快速操作保存为例如:将所选文本反转到剪贴板
It's now available from the Services menu in any application, eg TextEdit > Services , or the Services menu on the Context menu (right-click menu). 它现在可以从任何应用程序的“ 服务”菜单中获得,例如TextEdit > Services ,或上下文菜单中的“ 服务 ”菜单(右键单击菜单)。
You can also assign a keyboard shortcut in: System Preferences > Keyboard > Shortcuts > Services 您还可以在以下位置分配键盘快捷键: 系统偏好设置 > 键盘 > 快捷方式 > 服务
1 In versions of macOS prior to Mojave a Quick Action is called a Service . 1在Mojave之前的macOS版本中, Quick Action称为Service 。
Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. 注意: 示例 AppleScript 代码就是这样,并且不包含任何适当的错误处理。 The onus is upon the used to add any error handling as may be appropriate, needed or wanted.
责任在于用于添加任何适当,需要或想要的错误处理。 Have a look at the try statement and error statement in the AppleScript Language Guide .
查看AppleScript语言指南中的try 语句和错误 语句 。 See also, Working with Errors .
另请参阅使用错误 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.