KM — New Macro Hot Keys

KM — New Macro Hot Keys

Continuing the discussion from Macro to create hotkey trigger stopped working, another approach.

KM — New Macro Hot Keys Macros.kmmacros (175 KB)

Two simple macros for performing what are probably the two most frequent KM actions: creating a new macro with a keystroke trigger and adding a keystroke trigger to the current macro.

The implementation is kind of dicey, relying as it does on Found Images, but I have been evolving it seems to have settled down. I use them all the time — I can't stand the dance I have to do without them.

Note: while using New Hotkey Macro, after naming the macro you must hit Return/Enter to move focus to the keystroke box.

@MitchellModel -

That sounds very useful, but I prefer to look before importing anything into my own KM editor.

Is there a way to see those macro, here on the forum, before downloading?
Or is the only way to ask you to post an image?

Dan's MIM helps some.

It's not that these macros are so special, it's just that it there is no real way to do them, and this took months of use to hone to where they work well.

I don't know. Some people post images, some not. If I post, do I show everything expanded? Just the things that actually do something? Just what I wouldn't be embarrassed for other people to see? :slight_smile: I never know. In any case, here they are:

New Hot Key Macro

** New Hot Key Trigger**

1 Like

The unofficial standard is to post both macro file and image.
The KM Editor Share button makes this very easy.
See

Common sense indicates which Actions to expand before you upload the image. Expand those Actions which are:

  • The major "guts" of the macro, that do the heavy lifting
  • Unusual Action configuration that you yourself would want to know about macros posted by others
  • Uncommon or Rarely Used Actions
  • Common Actions used in an uncommon way

Collapse those Actions that are:

  • Well defined by the Action Title
  • Common use of common Actions (like "Set Variable to Text")

Also, several of us always posts the scripts used in the Macro in a separate code block. Here is a macro that makes it easy to post your scripts:

MACRO: KM Forum -- Paste Script Block

1 Like

Thank you, @MitchellModel.
Posting the image helps a lot.

Your level of detail is just right: easy to understand, without getting tangled up in details of IF statements.
.

Yes, indeed.
So your macros here are still highly useful, even if a little "dicey".
.

I certainly understand that sentiment -- from similar, personal experience.

And on that basis, you may not enjoy my comments, because they may suggest even more honing.

1. Instead of "Pause for X seconds" I try to discipline myself to use "Pause Until Condition".
It takes more work and more testing, but the benefit is more reliable macros.
Would "Pause Until Condition" benefit these macros, or not?

2. Your use of, "Click a Green +" is especially notable for the way you've handled cases with red minus and without red minus.
When I tried to create a macro to do this, I failed, because I didn't think carefully about that red minus.
You did, and its working.
Now, in your macro, I wonder if using Switch/Case, instead of "If", would make it easier to "hone" and so less "dicey".

3. Not specific to these macros, but I notice your careful use of "Hide Actions" view.
Makes perfect sense, but I wonder if you are actually using the "Actions" view?
I've found "Insert Macro By Name" so much quicker.
And easier, too, because shows pictures of actions.
(I prefer to avoid the mouse "dance" that "Actions" view demands.)

Your further thoughts, please.

The solution for adding a Hot Key Trigger posted by @ccstone, which I combined into one macro, seems to work very well and does not rely on Found Images.

See:
MACRO: [KM] Add Hot Key Trigger

Just as a point of practice I expect people to tune down the pauses as they find the macro working and want to speed it up. Also, brief pauses are always useful when macros aren't behaving as expected. Some things just aren't worth the time to discover a more elegant solution

I can't see what kind of Pause Until one would use to replace the pauses in these macros. I do use Pause Until whenever I can see a way to do so.

If I remember right, executing Hide Actions move the Actions list out of the way, which was necessary for some reason or other, or was at some point and no longer is. If the actions are not showing it's a no-op.

I know Mitchell talked about this, but let me expand on this a little. As I'm sure you know, just importing a macro can't cause any harm. It's only if the macro gets triggered that there might be an issue.

So before I import a macro from someone I'm not familiar with, I want to make sure that if there's any triggers I might not like - specifically, something that gets triggered more-or-less automatically, the triggers are disabled when I import them.

That's one of the reason's I wrote my Macro Import Manager. It forces me to examine the macro first, allowing me to disable any undesirable triggers before importing. The second reason is that I can change the Group so they go where I want them to go.

So my feeling is this: As long as I use MIM to do the importing, I don't worry too much about what macros I import. And believe me - I'm pretty careful with stuff other people wrote. :smile:

1 Like

If you hold down the keys:

  • Editor Quits Engine on launch if all modifiers are held down.

  • Imported macros are disabled if all modifers are held down.

-Chris

That is not well-known nor well-advertised.

@peternlewis, I would welcome a KM Editor Preference to disable all imported macros.

In this day and age of emphasis on safety and security, it would seem wise.

True.

I used to kill the Keyboard Maestro Engine before importing anything, but that's not necessary now.

I believe the wiki does not cover anything at all about importing or exporting – and should.

-Chris

Chris, I don't think I understand this. I am unable to reproduce this behavior.

Can you please provide the exact steps to import macros as disabled.
Thanks.

EDIT:

I have created this KM Wiki section, that needs to be updated:
Import Macros in Safe Mode

Hey JM,

Hold down all the modifier keys at once and drag-and-drop one or more files to import onto the Keyboard Maestro Editor icon in the dock.

Or – right-click on the file(s) to import – hold down all the modifier keys – and select “Open”.

-Chris

Chris,

Sorry, but neither of these work for me.
The macro is imported as "enabled", just like always.

Hey JM,

The release notes document it, and I have tested it several times.

I have no idea why it wouldn't be working on your system.

Note that if the Keyboard Maestros Editor is NOT running then the item will NOT be imported – the Keyboard Maestro Engine will be disabled instead.

-Chris

I can't find this. Can you please post the exact URL?

I have tried it on both El Capitan and Yosemite, but the macros always are imported as "enabled"

Keyboard Maestro 7.1

“Version 7.1 enhances the Custom HTML Prompt further allowing customised user interfaces to be built, as well as the ability to import macros disabled or quit the Keyboard Maestro Engine on launch of the editor (both if all modifiers are held down).”

-Chris

This is VERY unclear as to how to actually do this.
When I hold down "all modifiers" when I launch KM, and/or when I select "File > Import Macros", the Macro is STILL imported as ENABLED.

@peternlewis, we really need a better, more user-friendly method to import Macros as disabled.

1 Like

I second that.

And I'm interested in the solution, too.

Are you sure they are not being imported into a disabled macro group?

Keyboard Maestro will not disable them if they are within a disabled macro group, or if it creates the macro group, it will disable the group instead of the macros.