I don’t understand why only some apps are compatible with Hook’s built in “Copy Link and Selection” but I decided to build the functionality myself for web browsers.
tell application "System Events" to set the clipboard to ""
tell application "System Events"
keystroke "c" using command down
set theQuote to the clipboard as Unicode text
tell application "System Events" to set FrontAppName to name of first process where frontmost is true
if FrontAppName is "Microsoft Edge" then
tell application "Microsoft Edge"
set theName to title of active tab of front window
set theURL to URL of active tab of front window
else if FrontAppName is "Safari" then
tell application "Safari"
set theURL to URL of front document
set theName to name of front document
if theQuote is "" then
set the clipboard to "[" & theName & "](" & theURL & ")"
set the clipboard to ">" & theQuote & "\n[" & theName & "](" & theURL & ")"
display notification with title FrontAppName subtitle "Copied to clipboard"
Tweaked from this article to match Hook’s “Copy Link and Selection” style which also means that you can call up hook and paste the hook to a document. Hopefully, the Hook devs will add this functionality soon since this script is brittle (only works for the apps in the script). Also keep up the good work Hook devs!
It’s because our approach does not rely on the clipboard, but API’s if they are available; they aren’t always available. We also wanted to see what kind of traction we would get with this feature.
However, we have a goal of sharing a more general facility.
I need / want such capability. How do I use your script? I was surprised and disappointed to find that i can’t clip a selection from Safari or Chrome with a Hook link.
If you use Safari, you can use Hook share extension to get the selection and link:
(1)Select some text in Safari
(2)Click on Share button
(4)Select “Copy Selection and link” action
(5)Click on “OK”
Thank you for the quick reply, but Hook is not in my share list, nor is it in the list of apps that might be added to my share list.
What’s your Hook version and macOS version?
I’m running Mojave, 10.14.6; and Hook Pro 3.6.1 (4805; Integration v. 221) . Can’t find Hook on the share menu, nor in system preferences list.
I just tried Mojava(10.14.6) and it seems to be working fine. Could you please check if you have multiple copies of Hook on your machine?
I do not have multiple Hook apps.
I will try deleting and reinstalling the one I have.
Thanks for the rapid responses.
Update: Deleted and reinstalled Hook app and its supporting files. Hook, however, still is not on my list of shares or possible shares.
Latest release fixed the problem. Now works as advertised. Thank you.
Nothing unusual about finding bugs. But very unusual to have one fixed almost instantaneously. Thanks again.