Getting Part of the Name of the Executing Macro

I have a bunch of Macro which I name like this:

e - Extract customer number 
r - Replace customer number 
f - Find customer to number 
...

All of these macro have the same hot key trigger, so that they create a nice little palette.

In each macro I use notifications to give some prgress info. The title of these notifications I want to set to the name of the executing macro without the x - part.

I tried a calculation like this:

But this is doesn't work.

How can I extract the end of the macro name (everything from the 3th character) to a variable?

Thanks heaps for any help!

"Calculations" in KM are for numeric values and only produce numeric values.

For a string like a macro name, you could use a Get Substring action in some variant of this kind of pattern:

5 Likes

Hey @halloleo,

I usually default to using regular expressions for this sort of task, because they're so much more flexible than substrings.

e - Extract Macro Name v1.00.kmmacros (6.4 KB)

Display-Macro-Image

Keyboard Maestro Export

RegEx is definitely a bigger bite at the apple than substrings though.

-Chris

1 Like

@ComplexPoint @ccstone Thanks for the help.

Good to know that calculations are only for numbers -- and even better that this magic regex action exists - I thought I need to do this with functions...

Thanks again. :smile:

1 Like

There's another tricky way to accomplish this task.

image

1 Like