Jump to content
Sign in to follow this  

URL, Page Title and Selected Text Copy and Paste

Recommended Posts

The workflow takes the url of the active safari tab, and copies it to the clipboard.

If you want it also throws the the page title in there. 

If you have selected some text, it tries to recognize that and takes that instead of the page title. 

It also can directly paste that whole string.


That's it. Tremendously helpful for IM conversations or as a starting point for a Tweet.


I have bound it like this


  • CMD Option U to copy URL
  • CMD Option Shift U to paste URL
  • CMD Option K to copy Page Title and URL
  • CMD Option Shift K to paste Page Title/Selected Text and URL


Originally created by Michael Matochkin, I adapted the workflow over time and now publish it here. Original credits in the readme: Based on Alfred extensions by Luca Soldaini (original applescript by Dr. Drang) and Zibity


I've used an icon from the Stylistica Icon Set


That should cover it. And of course: here is the UPDATED workflow download link (see my latest comment for more info)




Edited by tschoof

Share this post

Link to post

Thanks.  I've tweaked the title/URL scripts to produce Markdown links instead -- replace the first tell block in each with

tell application "Safari"
	set theURL to URL of front document
	set theTitle to name of front document
	set selectedText to (do JavaScript "(''+getSelection())" in document 1)
	set myCount to count (selectedText)
	if myCount is greater than 0 then
		set the clipboard to "\"[" & selectedText & "\"]" & "(" & theURL as string & ")"
		set the clipboard to "[" & theTitle & "](" & theURL as string & ")"
	end if
end tell

Share this post

Link to post

I found the script wasn't working reliably. Tweaked it a little.


Also: the enabling of "Allow Javascript from Apple Events" in the Safari Dev menu is necessary for the text/title selection/copying.





Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
  • Create New...