Inline Markdown Link from Front Safari Tab

This quick TextExpander script is only provided because I searched for it and couldn’t find it.

I was looking for a way to quickly pop over the top Safari tab’s url over to wherever I was typing, in inline Markdown format. I found these two posts:

…but they both grabbed URLs for every tab that was open. I wanted the option to get just one at a time.

Here’s the applescript to do that (verbose and ugly, because I script in my own image…)

`tell application “Safari”

set theURL to URL of current tab of window 1   

set theTitle to the name of current tab of window 1   

set mLink to "[" & theTitle & "](" & theURL & ")"   

return mLink   

end tell`

EDIT: Now available as a service.