# "Copy Link and Selection" for browsers

**URL:** https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078
**Category:** Share Hookmark automation
**Created:** [May 6, 2022, 10:57pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078 "2022-05-06T22:57:05Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![SteveMoser](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/s/7bcc69/32.png) [@SteveMoser](https://discourse.hookproductivity.com/u/SteveMoser)
#### Post date: [May 6, 2022, 10:57pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/1 "2022-05-06T22:57:05Z")

</div>

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.

```auto
tell application "System Events" to set the clipboard to ""
tell application "System Events"
	keystroke "c" using command down
	delay 0.2
	set theQuote to the clipboard as Unicode text
end tell
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
	end tell
else if FrontAppName is "Safari" then
	tell application "Safari"
		set theURL to URL of front document
		set theName to name of front document
	end tell
end if
if theQuote is "" then
	set the clipboard to "[" & theName & "](" & theURL & ")"
else
	set the clipboard to ">" & theQuote & "\n[" & theName & "](" & theURL & ")"
end if
display notification with title FrontAppName subtitle "Copied to clipboard"

```

Tweaked from [this article](https://medium.com/@cu_ben/copy-to-markdown-47132f84a40b) 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!

---

<div class="post-metadata">

### Author: ![LucB](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/lucb/32/2228_2.png) [@LucB](https://discourse.hookproductivity.com/u/LucB)
#### Post date: [May 7, 2022, 8:25pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/2 "2022-05-07T20:25:00Z")

</div>

> [@SteveMoser](#):
>
> I don’t understand why only some apps are compatible with Hook’s built in “Copy Link and Selection”

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.

> [@SteveMoser](#):
>
> Also keep up the good work Hook devs!

Thank you!

---

<div class="post-metadata">

### Author: ![LucB](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/lucb/32/2228_2.png) [@LucB](https://discourse.hookproductivity.com/u/LucB)
#### Post date: [May 7, 2022, 8:30pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/3 "2022-05-07T20:30:13Z")

</div>

> [@SteveMoser](#):
>
> “Copy Link and Selection” but I decided to build the functionality myself for web browsers.

thank you for sharing!

---

<div class="post-metadata">

### Author: ![yooj](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/y/a3d4f5/32.png) [@yooj](https://discourse.hookproductivity.com/u/yooj)
#### Post date: [July 12, 2022, 7:29pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/4 "2022-07-12T19:29:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [July 12, 2022, 8:08pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/5 "2022-07-12T20:08:18Z")

</div>

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  
(3)Select Hook  
(4)Select “Copy Selection and link” action  
(5)Click on “OK”

---

<div class="post-metadata">

### Author: ![yooj](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/y/a3d4f5/32.png) [@yooj](https://discourse.hookproductivity.com/u/yooj)
#### Post date: [July 12, 2022, 9:44pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/6 "2022-07-12T21:44:05Z")

</div>

> [@bchend](#):
>
> 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  
> (3)Select Hook  
> (4)Select “Copy Selecti

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.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [July 12, 2022, 10:11pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/7 "2022-07-12T22:11:57Z")

</div>

What’s your Hook version and macOS version?

---

<div class="post-metadata">

### Author: ![yooj](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/y/a3d4f5/32.png) [@yooj](https://discourse.hookproductivity.com/u/yooj)
#### Post date: [July 13, 2022, 1:26am UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/8 "2022-07-13T01:26:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [July 13, 2022, 1:40am UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/9 "2022-07-13T01:40:58Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![yooj](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/y/a3d4f5/32.png) [@yooj](https://discourse.hookproductivity.com/u/yooj)
#### Post date: [July 13, 2022, 4:13pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/10 "2022-07-13T16:13:13Z")

</div>

> [@yooj](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![yooj](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/y/a3d4f5/32.png) [@yooj](https://discourse.hookproductivity.com/u/yooj)
#### Post date: [July 20, 2022, 5:59pm UTC](https://discourse.hookproductivity.com/t/copy-link-and-selection-for-browsers/5078/11 "2022-07-20T17:59:28Z")

</div>

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.
