Personal Knowledge Base

A personal knowledge base

AppleScript

#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.

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

  set rawRFR to "RFR: " & URL of currentTab & " โ€” " & name of currentTab
  try
    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 April 2017