Applescript to Acquire Markdown Link

For various reasons, I want to write a Keyboard Maestro script that will include activating Hook and getting a markdown link to a selected item.

(It will be acting on an email selected in Postbox.)

Because ⌘M is assigned to Minimize Window in Postbox and Postbox will not let go of it, I cannot make this script work by simply having Keyboard Maestro activate Hook and type ⌘M.

I’m thinking my only hope here is to have Keyboard Maestro activate Hook and then executive an Applescript. But I don’t understand Applescript well enough to write this script. Can anyone help? Please give details. Thank you!

hope this helps:

tell application "Hook"
	set b to bookmark from active window
	set the clipboard to "[" & name of b & "](" & address of b & ")"
end tell

P.S. Also there is Copy Markdown Link shortcut option in Hook’s Preferences.

1 Like

You can also configure a global keyboard shortcut for the Title bar (context) version of Hook’s Copy Markdown Link in its Preferences > Shortcuts pane — global meaning it will be available even while Hook window is not active.

updated 2021-05-11: oh, I see @Nima has already answered that.

Thank you for the answer and script, @Nima, and Welcome to the Hook Productivity Forum !

1 Like