2 Macros in 1

This is very interesting. I can rename my macro and totally different sets of actions can be triggered.

If the macro has different triggers, you can use the TriggerBase token to differentiate between them and behave differently as well.

image

Also, for status menus and palette clicks, you can use the TriggerValue token to do different things based on the modifiers held down, eg:

image

3 Likes

Thanks Peter Extremely useful.
How do you put the Shift and Opt in Trigger Value by the way.

Keyboard Maestro puts it in based on the modifiers you are typing. If you mean, how do you type it in the action as shown, just copy and paste the characters or use a macro to expand them.

⌃⌥⇧⌘

Note that that is the canonical order for them to appear - control, option, shift, command.

Text Expansions Macros.kmmacros (6.6 KB)

1 Like

I can type the Option character by using the Show Emoji and Symbols tool, but how do I type the Left, Right, Up, and Down Arrows? How is Up Arrow as a character distinguished from Shift as a character to match against %TriggerValue%? I've installed the Text Expansion Macros.kmmacros but they only include the modifier keys, not the arrow keys or anything else that's on the keyboard but difficult or impossible to type as a text string.

I'm writing a simple macro to alias the Ctrl+Left and Ctrl+Right system commands that will move left and right between desktops. I want to be able to type the hotkey one-handed so I can keep my other hand on the mouse, holding down the button so I can drag a window between desktops.

I would like to have a single macro and test on %TriggerValue% but I can't figure out how to specify Option+Left Arrow, etc.

Let me double check my usage: The way to test the %TriggerValue% with something like:

If all of the following are true:
    The text:
    %TriggerValue%
    contains ________________
execute the following actions

Correct? So I have to get the Left Arrow and Right Arrow into that "contains" field, right?

I've been poring over the Forum, the User Guide, and the Wiki, without any luck.

Thanks.

Text Expansions Macros (v9.2)

Text Expansions Macros.kmmacros (7.4 KB)

You can import this into your keyboard Maestro ...
Change as needed....
for example I don't want to use in Finder so I disable that.

Thanks Raz,

Using the Text Expansion Macros, I can insert the Option "character" to test if the hotkey trigger includes Option, but not if it includes Left Arrow.

Since my desire is to use Option+Left Arrow and Option+Right Arrow, I need to be able to identify the arrow key that's been used. That's my question.

Thanks.

I found the answer:

Thanks, hello.

1 Like

Here are some characters:

  • :arrow_up_down:

The ⌃ is not an arrow character.

There are a variety of unicode arrow characters.

Create your macro with a hot key trigger as appropriate, and then a Set Clipboard to Text %TriggerValue% action, and that will get you the required character.

1 Like

Thanks Peter,

My concern is that indeed, there are a variety of Unicode arrow characters with lots of variations and styles. You showed several Unicode arrows. I only see four in your list that look like they could possibly be used in matching %TriggerValue%.

Will any of them that are down arrows match the Down Arrow keyboard character as %TriggerValue% if it is used as a hotkey? E.g., can I use ⤓ in my comparison text to match a keyboard Down Arrow hotkey?

Thanks.

No.

You will need to find the right character, as described. Copy it as described, or copy it from the Engine.log file after triggering.

There is no particular guarantee that the arrow keys wont change in the future either.

No guarantee from you, because you might have to change them, or because Apple or Unicode might change them?

Wow. THAT is a source I can trust, without having to worry about whether or not some browser has rendered it with the correct character. Here's a sample line that I just found:

2021-09-21 21:50:17 Execute macro “Change Desktop L/R Using Keyboard One Handed” from trigger The Hot Key ⌥Left Arrow is pressed

Does this mean that to match the arrow key in %TriggerValue%, I just include the string "Left Arrow"? Or is there a glitch and it should have been the Unicode arrow in the log file?

Answered my own question by testing (when I should have been going to bed...)

No, the Engine.log file records an arrow keypress as, e.g., "Left Arrow", but that string does not work to match a Left Arrow in the %TriggerValue%. So copying from Engine.log will work for some of the special keyboard keys, but not all of them.

Oh well...

Set Clipboard to Text %TriggerValue%.

The TriggerValue token contains the key.

The Trigger token contains the text, as shown in the Engine.log.

2 Likes