The problem with this approach is that it completely kills the whole point of setting up a text service, and it requires the user to destroy their current Clipboard to use my service. I should then be able to take this data and do with it what I need. I've not tried it yet, but it looks like the AS Clipboard commands like me indicate that I want to RTF version of the data, as does the command-line pbpaste command. Playing around, it looks like just about every app that copies formatted text-Safari, TextEdit, Entourage, etc.-places a copy on the Clipboard as RTF. One option I thought about is to pull from the Clipboard. Is, in effect, plain-text, I would expect this to be possible since it doesn't introduce data type incompatibilities, but hey, what do I know □. Thus, my question: how to get the user's selection in my AppleScript action as RTF text versus plain text. The issue is that the workflow, or at least the AppleScript action, only seems to be receiving plain text, which just won't work for me. Once I have the RTF, I can do the processing I'm trying to do without a problem. Now, what I'd ideally like is to receive RTF text, which is really just text with markup, much like HTML (and so can be handled like plain-text). this stuff seems to be very poorly documented). When the user selects text in some application and runs my service, the selected text is passed into my workflow, which passes it into the AppleScript action via the input parameter (I have no idea what the parameters param is for. That action has the default on run handler I've already indicated. I've used Automator to create a service that operates on 'text' data types, and the sole action in the workflow is a "Run AppleScript" action. It's not what to do with formatted text that I'm having an issue with, it's getting formatted text with which to do something. Use AppleScript version "2.4" - Yosemite (10.I'm not sure we're on the same page, or maybe I'm just misunderstanding you. # The AppleScript version can be used in an automation tool (FastScripts,Keyboard Maestro, BetterTouchTool, etc.) # the clipboard without using Hook's Global Shortcuts or UI # Copies a markdown link for the active window to Shortcuts can convert most Automator workflows into shortcuts that carry out the same functions, events, and automationsyou simply drag a workflow file into Shortcuts and the conversion happens automatically. Then the script will target the previous app which was active before Script Editor was made the active app to run the Script. Use Automator workflows with the Shortcuts app on Mac You can import Automator workflows into the Shortcuts app on your Mac. To change the script, delete the (* and *) characters where shown. If you use an app like Script Editor to run the Script, the script needs to be changed, because the current active app (frontmost) at execution is not the active app for Hook to target. If you use FastScripts with a global Shortcut set for the same combination as Hook uses for Copy Markdown Link (but with Hook’s disabled), it should all mimic using Hook. By default the script expects to be run just like Hook (i.e. The following script should do that for you. That script is about working with a Markdown link already on the clipboard.įrom the video it seems what you may need is an alternative to Hook’s Copy Markdown Link because Hook’s global shortcuts are not working as expected? Set Įnd The above Script can be modified to work with all apps and I will post that later. If (count of _theParts) > 1 then - link is a markdown link (url) Set _link to my findReplace(_link, searchEscape, "") Set _title to my findReplace(_title, searchEscape, "") Property subStrMarker : "](" - marker for splitting markdown link parts Use AppleScript version "2.4" - Yosemite (10.10) or later Modified version of Brett Terpstra's script "Hook to Clipboard" Handles Hook's Copy link and Copy Markdown link Feel free to message me if you have any questions - Make bookmark with Hook link copied to clipboard It has had brief testing using Hook’s Copy Link and Copy Markdown Link including Titles full of escaped characters. Give this script a try should do the job.
0 Comments
Leave a Reply. |