How to Trigger KM Macros from LaunchBar

Just a note for anyone interested in running KMacros from LaunchBar. Someone (affiliated with LB, afaict — Manfred by name) has provided an LB Action that when triggered in LB lists all the currently available KMacros.

Find it and some discussion on the LB Actions discussions.

I didn't turn this up in a quick search of the KM discussions. Is there any reason not to recommend and use it?

Is the equivalent functionality already available in KM? I use palettes, but only with the mouse cursor. With this LB Action I am able to keep my fingers on the keyboard, and not have to remember every KM macro trigger.

Is it possible that there might one day be an LB Rule that indexes KMacros?

Hey Kirby,

The Trigger Macros by Name action is better overall in my opinion, because it not only lists the available macros – it lists their associated keyboard shortcuts. This is very handy for me, since most of my macros are keyboard-driven – and occasionally I forget a hotkey.

However I think heavy LaunchBar users will like this.

-Chris

1 Like

Thanks Chris. I’ll look into the “Trigger Macros by Name” … actually, I just set it up, and I agree it is better overall. Thanks for the tip.

For anyone following along: both work well. The primary differences to me are:

  • With the TMBN KM Action included in a single-Action KMacro that is triggered by a key-chord, it immediately presents a “smart” search field (dynamically lists results based on the current search string); to get to the smart search field via LB, one must trigger LB, then run the LB Action “Keyboard Maestro Macros” to bring up a smart search field of Macros. When everything is kept inside KM, there is one fewer layers to navigate.
  • As Chris specifies, there is more information in the KM TMBN palette than appears in the LB search results. This provides a welcome level of assurance for me — when I use the LB method of running my KMacros, I always pause and double-check: “Is this really the macro I want to run?”. I don’t need that pause when using the KM TMBN method.
  • An important (to me, at least) similarity: each looks good. The KM TMBN palette seems to use a default Yosemite frame-less window (at least on my 10.10.5 set-up) — it is nearly identical in appearance to the LB palette’s “Yosemite Light” appearance pre-set. This is, imho, much easier to use (read, navigate) than any of KM’s built-in palette styles (afaik :blush: ).

@peternlewis: Is is possible to use the same palette style for “regular” palettes that appears when “Trigger Macros By Name” is run? Afaict, the Palette Style “Theme Editor” does not include any theme that looks like the TMBN palette, nor any settings that would allow one to mimic it.

There is no palette style that matches the "Spotlight-like" style of the Trigger macro By Name.

The closest would be the Evening style:

You can configure a custom palette theme color style with:

defaults write com.stairways.keyboardmaestro.engine CustomPaletteTheme "0,90,74, 110,90,74, 256,90,74"

The style includes 3 or 6 colors (being background, text, highlighted letter, selected background, selected text, selected highlight letter). The background brightness is dropped by 33%, but if there are only three colors, then the selected background color is the background without the 33% drop. You can select the Custom style in the Theme Editor.

If you'd like to design a new style, I am happy to hear about it, I've already added the "Gemmell Purple" theme.

Peter — thanks for the reply and the offer. It's the spacing and the font of the "Spotlight-like" TMBN palette that I primarily want to emulate (and only secondarily the colors). I found the dozen or so KM palette color schemes, with the customizable opacity, gives a good range of options for the standard KM palette. (If you are interested, LaunchBar also has a "Yosemite Dark" theme which, imho, is handsome and broadly useable. Screenshot:

)

BTW — kudos for — and please don't remove — the long text line showing the currently selected result of the TMBN search. I include as much information as I need in my file names; although the search result appears three times in the TMBN palette (top line name of selected search result, left column list of search results by name, right column details of selected search result including name), it is only on the top line that my longer names have any chance of being shown in full. On my rMBP this top line search result is a little too half-toned; I haven't tested it on other machines. (Formatting fixed)

I’m personally loving KM and LB integration and would never go back: press Command+Space, type KM, press Space, [type to search your action or chose from the list], press Enter, boom!

See it in action:

  1. (horrible gif)
    Uploading…

  2. (screencast)
    Link: https://www.dropbox.com/s/6ry4jzw7fqfsh7h/km-launchbar.mov?dl=0

Well, you might think this is going forward: set another easy key-chord to trigger KM's Trigger Macro By Name built-in Action (key-chord example: ⌥{space}). That shortens your trigger-flow to

⌥{space}, search-macro-string, {return} ➞ Boom!

:blush: .

Hey Kirby,

Eh? Where can you assign an action a key-chord? (Versus a string.)

Thanks.

-Chris

Ruh-roh ... I think I might be in trouble again :mouse: .

What I mean is (stated above):

Does that count, or am hopelessly confused? (Additionally evidenced by my not understanding what you mean by assigning a string to an Action.)

—Kirby.

Hey Kirby,

No; it's me who was confused. :smile:

I thought you were still talking about LaunchBar, since @gustavomd's post was about the LB-KM action.

My eyes must have skipped over this part: "KM's Trigger Macro By Name built-in Action".

-Chris

1 Like

For anyone interested, you can also skip typing "KM{space}" into LaunchBar and trigger the LB Action directly via applescript.

tell application "LaunchBar"
	perform action "Keyboard Maestro Macros"
end tell

Assign a shortcut to this applescript in Keyboard Maestro and you have direct access via LaunchBar!

6 Likes

Neither of these links works.

I’m believe I have deleted those files from my DB account.

I have just discovered (I'm probably really late to this game) that one can create Launchbar actions which trigger specific KM macros or invoke palettes of KM macros.

For example, I created a LB action called "URL Preview" which triggers a KM macro (which I posted about here) which pops up a web browser window using the URL in the clipboard.

Basically, I made the LB action execute a simple Applescript:

And ... boom!

To make it simpler:

Using the trigger URL of your KM macro you can create a Search Template in LaunchBar.
For example:

kmtrigger://macro=B6256C93-9E2F-4DC5-8DBF-7D61C003022E&value=*

This has the nice side effect that you can pass along a value to the macro.

(Hit ⇧Return to omit the value query; the previous value will be used then.)

1 Like

I am gobsmacked. I will use this. I would still need to create specific actions for some macros, because I have a number of macros which have the same name, but are distributed in different app-specific palettes.

OK, when I trigger this with a macro name as the value, I just get the Trigger By Name dialog with nothing in the query.

No, the value is not there to trigger a specific macro. It’s the macro UUID you see in the template that triggers the corresponding macro with that UUID.

The value is what gets passed to that macro. It can be used by the macro itself. The value (from the LB search template) will end up in the %TriggerValue% token of the launched macro.

In my example I used the value to set different options for the "Trigger Macro by Name" action:

Trigger Macro by Name(For LaunchBar).kmmacros (2.4 KB)

Hope it is clearer now :wink:

BTW, it seems you can’t use the %TriggerValue% token in the Search field of the above macro. It will not get expanded. Variables either.

I guess, my example is a bit confusing. A more "normal" use-case for passing a value would be, for example, to pass a number to a calculation macro.

###Edit / PS:

Here is a more straightforward example how to make use of the value from the LaunchBar search template:

Create a Search Template in LaunchBar with this content:

kmtrigger://macro=0E589747-92E3-4D17-A2E5-3A0F41537DE9&value=*

Install this macro in KM…

Example: Working with a Value from LaunchBar.kmmacros (1.6 KB)

… and then launch the Search template in LaunchBar. The string you enter will be spoken by the macro.

3 Likes

Tom, please remind us with low memory how to launch this Search template in LB. (I know, you've probably told me a hundred times. :wink: )

You launch it as you launch anything in LB: by typing the fuzzy character sequence that leads you to your action. Initials serve best.

For example, if you have named your serch template “Speak Something via KM” then it should be sufficient to type “ssk”. If not on top of the results, it should be near the top of the results.

Unless you have already 30 other actions that respond to the same initials :wink: Then it might take two rounds of training for LB.

1 Like