Sun, 20 Oct 2013

Linkblogging Aid: Frontmost Safari Tab's URL and Title Formatted For Markdown

This AppleScript snippet is probably useful to no one except me, but if it saves even one other Mac-based Markdown-using linkblogger a few seconds, why not?

I have it attached to an Alfred hotkey. (download)

tell application "Safari"
	set myTitle to name of document 1 as string
	set myURL to URL of document 1 as string
	set mdstring to "[" & myTitle & "]" & "(" & myURL & ")"
	set myResponse to (display dialog "Selectable Markdown Link Text" default answer mdstring)
	if myResponse's button returned is "OK" then set the clipboard to myResponse's text returned
  end tell

:: 03:47
:: /tech/computers/os/osx/scripts | [+]
::Comments (0)




Associate with well-mannered persons and your manners will improve. Run
with decent folk and your own decent instincts will be strengthened. Keep
the company of bums and you will become a bum. Hang around with rich people
and you will end by picking up the check and dying broke.
— Stanley Walker