Execute KM Macros from the Editor Window

Since there's no "try" button for macros in the editor window, I built this AppleScript to execute selected macros. Quick and dirty.

1 Like

Not sure what it is about my browser settings, but neither Chrome nor Safari seem inclined to download that link from your site to this Yosemite system :- )

(in each case, url and blank screen, no download)

If you get a moment, might you be able to drag the script into one of these editing boxes ?

(I also miss the immediacy of the try button)

The download link does not work on my computer (Safari on Yosemite)

Try again. Bad link. Or download here:

https://docs.google.com/a/inik.net/uc?id=0B76y2HbAyIGLXzktcFlvN0ZrWjQ&export=download

Good idea. Thanks for sharing.

What I have been doing is to reserve the shortcut of CTRL-SHIFT-T for testing of my KM macros, and assign it as needed.

Much better …

My first thought (in JXA) was a bit baroque : - )
(obtain and call a UUID)

function run() {
	var	aKME = Application('Keyboard Maestro Engine'),
		a = Application.currentApplication(),
        sa = (a.includeStandardAdditions = true && a);
		 
		
	// Get the UUID of the selected action
	aKME.doScript(
		"<dict><key>IsActive</key><true/><key>IsDisclosed</key><true/><key>MacroActionType</key><string>SelectMenuItem</string><key>Menu</key><array><string>Edit</string><string>Copy as</string><string>Copy UUID</string></array><key>TargetApplication</key><dict><key>BundleIdentifier</key><string>com.stairways.keyboardmaestro.editor</string><key>Name</key><string>Keyboard Maestro</string><key>NewFile</key><string>/Applications/Keyboard Maestro.app</string></dict><key>TargetingType</key><string>Specific</string></dict>"
	)
	// Run the UUID
	aKME.doScript(sa.theClipboard());
}

( In either case, of course, calling it on itself risks uncontrolled recursive descent … : - )

A better-research (briefer) JXA version might have been something like:

var kme = Application("Keyboard Maestro Engine");

Application(
	"Keyboard Maestro"
).selectedmacros().forEach(function (id) {
	kme.doScript(id);
});