Linked List

A personal knowledge base


#Interact With Safari

This script gets the current tab in Safari and uses the name and URL to generate a string that is copied to the clipboard.

tell application "Safari"
  set currentTab to current tab of front window

  set rawRFR to "RFR: " & URL of currentTab & " — " & name of currentTab
    set rfr to do shell script "echo " & quoted form of rawRFR & " | sed -E 's/ by [^ ]+ ·.*$//'"
    set the clipboard to rfr
  on error errMsg number errNum
  end try
end tell
Last modified: 24 Apr 2017