简体   繁体   中英

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. I used BetterTouchBar app for saving selected text but I can't do anything with it. 在此输入图像描述

How can I do that with or without 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 *)

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).

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 .


Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. 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 . See also, Working with Errors .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM