Skip to content

Instantly share code, notes, and snippets.

@melangue
Created February 5, 2017 09:28
Show Gist options
  • Save melangue/33c521c3df849c4106c1fd3f7b9a498d to your computer and use it in GitHub Desktop.
Save melangue/33c521c3df849c4106c1fd3f7b9a498d to your computer and use it in GitHub Desktop.
Easily copy your text selection + url, title from current tab in Safari and today's to clipboard. Useful for referencing.
-- Safari - this copies Title, URL, Date (current tab) and text which you highlighted to the clipboard
-- originally from here: https://discussions.apple.com/thread/4561056?tstart=0
-- modified to show tab's Title.
-- I recommend assigning it to a shortcut, ctrl + c for example.
-- V
tell application "Safari"
activate
set theURL to URL of front document
set theTitle to name of front document
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
set theDate to do shell script "date +'%d-%m-%Y'"
set the clipboard to theTitle & return & theURL & return & selectedText & return & theDate as string
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment