Copying the Current Page From Safari

If I’m preparing a bunch of links for a blog post or something, it’d speed things up if I could hit a button and have the computer do everything for me. Here’s an AppleScript to do just that.

tell application "Safari"
  set theURL to URL of current tab of window 1
  set theTitle to name of current tab of window 1
  set the clipboard to "[" & theTitle & "](" & theURL & ")"
end tell

That’ll copy the URL and title of the current tab in Safari as a nicely formatted Markdown link. I tied that into a Keyboard Maestro shortcut, so that I can quickly make the link with ⌘⌥⌃C, then paste it into whichever document I’m working in.

This’ll probably work with Chrome too, but I don’t know how much it supports AppleScript.

Tags: script

Copyright © 2018 - Scott Williams - Powered by Octopress