And sorry if this has been asked several times before, but I couldn’t find an answer to it.
I’m looking for a way to capture (text) highlights from articles I’m reading online - either with a keyboard shortcut or an Alfred workflow.
The action should capture whatever text I have highlighted, create a new draft with the next and also include the URL of the webpage where the text is captured from.
Drafts has a share extension on the Mac which can do this in Safari, just as it can on iOS. Click the share menu in the Safari toolbar, then Drafts. You may have to select “More…” and enable the Drafts share extension.
Catalina (10.15) note: As of the time I am writing this response, macOS 10.15.3 still has a bug that prevents third party share extensions which integrate with Safari from being enabled. They simply do not appear in the list of share extensions in System Preferences. This has been reported to Apple by multiple sources, hopefully they will resolve soon.
Thank you so much for this. You have saved me a lot of trouble. I was beginning to think it was a problem with my setup that the Drafts share extension was nowhere to be found.
I don’t use Alfred, so I can’t tell you how to use it to run an AppleScript, but this is (approximately, at least) the AppleScript you can run:
tell application "Google Chrome"
set theURL to URL of front window's active tab
set theQuote to (execute front window's active tab javascript "window.getSelection().toString()")
end tell
get theQuote & linefeed & linefeed & theURL
This gives a plain text result, with the quote followed by a blank line and the URL. You can jazz it up with Markdown or HTML as you see fit.
As you can see from the last line, the output is left just sitting there. I don’t know how to make a new draft directly, as there appears to be no AppleScript dictionary for Drafts.
If I needed this ability, I would use Keyboard Maestro to run the script and paste the results wherever the cursor is (presumably in some text editor). Chrome doesn’t have to be the active app for it to work.
I don’t think it’s possible to do the equivalent on i[Pad]OS, as Chrome doesn’t have a Shortcuts extension for running JavaScript.
I would add that it should be possible to create a javascript bookmarklet to copy the page title, URL and highlighted text in Chrome or Firefox to the clipboard. I’ve cobbled together similar bookmarklets in the past, but my javascript isn’t good enough to do it quickly. From there, it might be possible to have KM or Alfred “open” that bookmark in your browser, and then put the clipboard contents into Drafts.
To @tf2 and @marsnielson’s points, I’m sure the same idea would work in a bookmarklet, but I’m not skilled enough at them to try.
One thing about this macro is that Chrome asks for permission to open Drafts every time I’ve run it. I suspect there’s a way to turn that warning off, but
I almost never use Chrome, so it’s not worth it to me.
The extra safety is probably worth the slight annoyance of having to give approval each time.
On iOS, why does Drafts appear as an option under Share Extensions for some web pages but not others?
For example, when I click on share extension box at the bottom of Safari at this site, I see the Drafts app as one of the choices. But I do the same thing at this site and Drafts app is not available as an option.
Mac OS iMac
Instead of needing to use the mouse.
Is there a keyboard-command for the Safari share menu for Drafts to capture urls in this full format including the name of the URL?
Example: