Typed String condition failing to detect Title Case (v11.0.3)

Unless I'm missing something, Keyboard Maestro isn't making a distinction between the "otherwise" and "title case" conditions.

The macro below demonstrates this. Given the specific characters typed to trigger it, 3 different strings should be displayed:

TRGR → "Uppercase"
trgr → "otherwise"
Trgr → "TitleCase"

The first two work as expected, but when capitalizing the first letter of the trigger, I get:

Trgr → "otherwise"


Title Case Malfunction?.kmmacros (3.5 KB)

1 Like

I don't have the answer yet, but I do notice that if you switch your two tests, and place Title Case first, it does detect Title Case. This may be a clue.

If you separate the conditions, it seems to work correctly:

1 Like

I don't know why that version doesn't work (@peternlewis may), but this version works. Instead of using the typed string, I used the trigger value, and matched via regular expressions:

Title Case - Revised Macro (v11.0.3)

Title Case - Revised.kmmacros (3.1 KB)

-rob.

2 Likes

This is actually a bug - the Typed String condition only works if it is in the top level action list.

This is why it works in @Airy’s version - all the actions are at the top level. It fails when the actions are nested within any other action.

Fixed for the next version.

2 Likes

I swear that the last two posts weren't showing when I started on this... So, answered already and feel free to ignore, but the below may still be useful.

Summary

I think it actually shows something else -- that you can't nest tests of a typed string trigger's case. Re-order your macro so the first test is for title case and the nested test is for uppercase, then title case works fine but uppercase fails.

Compare that with the following, which seems to work as expected (I find "Display text" easier to use than Notifications when debugging -- they stay on screen until dismissed rather than being overwritten):

Title Case Malfunction? copy.kmmacros (7.4 KB)

Image

I've not really used this is feature, and that the test performs differently in different situation appears to be a bug. The fact that there's a test there at all implies it's there to be used -- but that's not really what "affects case" is for. From the trigger's Wiki page:

You can have the case of the typed string and affect Insert Text actions. This means that if you type the string in all uppercase, the resulting Insert Text will also be uppercased. If you type just the first letter in uppercase, just the first resulting Insert Text will be uppercase.

With a new TextEdit document open, try your various triggers with the following macro active to see (what I think is) the intended use:

What Does "Affects Case" Do?.kmmacros (2.7 KB)

Image

If you do want reliable single-action case-dependent branching, something like this should do it:

Trigger Case Choice.kmmacros (6.5 KB)

Image

2 Likes