Hook.app Scripts for Keyboard Maestro Editor

Cross-Post from Hook Forum

I've created some scripts that enable Hook.app to work with the Keyboard Maestro Editor and I figured I'd post them here too. For those unfamiliar with Hook, it's an app that quickly brings up other items you've linked to based on your current context. Invoking its shortcut brings up a launcher-like window with a list of connected items.

In the case of Keyboard Maestro Editor, these scripts will link to Macros, Macro Groups, and Smart Groups and allow you to link other documents like URLs, notes, or any other supported file types. When you select the KM item it will open the Macro/Group in the Editor.

Possible Use Cases:

  • Link a note with macro ideas to a macro draft
  • Link a todo item to a macro that needs fixing
  • Link Keyboard Maestro Wiki urls you referenced when creating the macro

Demo:

Hook Scripts

Get Address:

tell application "Keyboard Maestro"
	set s to selectedMacros
	if (count of s) is less than 1 then return
	set uuid to first item of s
	if exists (macro id uuid) then
		set n to name of macro id uuid
	else if exists (smart group id uuid) then
		set n to name of smart group id uuid
	else if exists (macro group id uuid) then
		set n to name of macro group id uuid
	end if
	return "[" & n & "](keyboardmaestro://m=" & uuid & ")"
end tell

Open Item:

set kmUrl to "$0"
tell application "Keyboard Maestro"
	activate
	repeat until frontmost
		delay 0.3
	end repeat
end tell
do shell script "open " & kmUrl
2 Likes