Create hotkey to activate 'insert trigger' within km window

Nope. As I stated previously:

For me, issues like this aren't worth the effort to resolve.
This is most likely something that @peternlewis would have to change, or better, give us a shortcut key to add a trigger.

I can just manually arrow down and press RETURN, easy enough.
So, for my use, I remove these Actions:

Yeah, I removed them as well. But since nearly all of my triggers are hotkey based it would be nice to cut down on those two clicks.

OK, @nikivi, just for you, I persevered a bit more. :smile:

I generally don't like to use "Found Image", but sometimes that is what it takes.

This works for me, and does so quickly:

Just copy/paste this image on your screen into the "Click at..." Action:

EDIT:
You may need to adjust the "fuzziness factor". Make it more fuzzy.

I also checked "Restore Mouse Location" on the "Click at .." Action so that the mouse will return to where it was after the macro is finished:

Oh wow, thank you Michael. This is kind of you.

This however doesn't work. Says no unique image is found. I dragged the image as you said.

Please carefully review my macro, and duplicate exactly.

In particular:

  1. The "Click at" Action MUST be set to "in the front window"
  2. Make sure this Action is closed before trying to run the macro
  3. Make sure all Actions are in the "If/Then" Action.

I have done everything correctly I believe :

Pretty sure I don't need the if clause since macro is in the group for KM only but have it anyway to make sure.

I am not sure about step 2 but I think I have tested it correctly too. Just created new macro and tried run the trigger. Say no unique image was found.

Troubleshooting:

  1. Did you copy the New Trigger image from your KM Editor, and then paste into the "Click at" action?
  2. Try adjusting the "fuzziness factor". Make it more fuzzy.
  3. As a test, hide everything on your screen except the KM app.

Problems like this is why I don't like to use "Found Image". :frowning2:

1 Like

Wow, that is a lot of messages. I’ll leave you all to read them, but will add this note:

The Press Button action is waiting for the press to complete, which in this case wont happen until the menu is dealt with.

If you want to ignore that fact, and complete immediately, then turn off all the notification/aborts, and set the timeout of the action to something very small (10 hundredths of a second for example).

Thanks for the response, Peter.

I tried that, except that I don't see any way to set the timeout of this action:

Is there some other way to do so?

Ahh. Darn. Looks like it is entirely synchronous, so the Engine is essentially locked up while it is stuck in there.

I don’t see any workaround for that I’m afraid, so looks like resorting to clicking is your best bet. Ugly.

Thank you, making it more fuzzy worked. This is perfect.

1 Like

That explains why I could get my workaround to work.

I was going to make it so if you triggered it again, while it was waiting, it would do the arrow key/return thing. Essentially, you'd press your hotkey twice.

I used a Semaphore to tell if it was already running. But the second trigger wouldn't run the macro until the first on finished.

Hey Folks,

Hmm...

Give this a try:

New Keystroke Trigger v1.00.kmmacros (5.3 KB)

Contains two macros:

New Keystroke Trigger → Open Menu

New Keystroke Trigger → Keystrokes

It works very reliably from FastScripts and seems pretty reliable when run from Keyboard Maestro.

-Chris

[EDIT: Replaced macro with v1.00 – bug fixes.]

4 Likes

Macro in post #30 update to version 1.00.

I had to make the button finding code more fault tolerant, because Keyboard Maestro was returning different information to System Events for different macros.

-Chris

To All:

This may, or may not be obvious, but If you want a macro that creates a new hot key trigger, you need to copy the two actions from the second macro to the first, like this:

I also added a Pause of 0.5 seconds to give the menu time to display.

1 Like

Hey JM,

No. I deliberately made that into two macros, and it works every time on my system.

-Chris

This works great. Thank you.

Chris, it was not obvious that you call the second macro from the first. You don't mention this anywhere in the comments or in your post.
That's why I added the actions.

But why would you do it like that?
I don't see any advantages, and several disadvantages.
I must be missing something.

4 posts were split to a new topic: When to Start a New Topic

Thank you very much, @ccstone, for this work.
I just discovered it today.
Very useful.

I recommend adding bold warning in comments about changing name of the second macro, the small one.
The potential problem was revealed above by:

.
That is an essential factor.

To fit my own naming conventions, I change names of incoming macros.
Probably many others here do similar.

Was not apparent that second macro name is buried at bottom of Apple Script in the first macro.
Name must be changed there, too, or it won't work.

1 Like