KM to 'type' in the Prompt With List field

I have some macros which will work far better with the Prompt With List field and I have started to make changes. One of these is central to my workflow; previously I had a Prompt for User Input which offered a list of codenames, itself read from a file.

So %CodeName% would be selected from %CodeNameList%, which in turn would look something like this:

Apple|Banana|Orange|Grape|Peach

My KM macro is semi-smart; based on what I have been doing previously, it will try and predict what that code will be, so in fact the choice offered is:

%CodeName%|%CodeNameList%

This means if my last action has been on Project Banana, KM knows this and offers it as the default choice.

Am I able to get a similar effect with the Prompt With List field?
I tried Insert Text with Typing and that hasn’t worked for me.

Assuming you're reading CodeNameList to a variable, and if it's less than 99 items, you could try something like this before the Prompt with List action:

This won't pre-populate the search prompt with CodeName, but it will put it at the top of the list prompt so it's just a quick down keystroke to select.

That wont work, the list is alphabetically sorted.

I will add a default text option to the list of todo items for the Prompt With List

2 Likes

Aha. Good to know, and good to hear we’ll be getting a new option down the road!

Thanks, Peter.

It would also be great if you can add a Window Title field, so the macro action could tell the user what the list is for, what they are selecting.

I would also like to be able to specify the width of the prompt.

Hey guys, if you need more flexibility than what the Prompt with List can provide you, then you might checkout this great macro by @DanThomas:
###MACRO: Spotlight Search Prompt

It is highly customizable. Dan has provided a set of macro options that make it easy to customize, and then you can go further by customizing the JavaScript and HTML code for the prompt.

1 Like

A post was split to a new topic: How Do I set the Width of the KM Prompt with List Action?

The default text option was a great addition—thank you. I've since become aware that the Prompt With List field doesn't seem to work with diacritics (letters with accents)?

I often use a Variable for the default and if that happens to include a string like Frédéric then nothing is displayed. I have to delete what is in the field and retype Frederic (or as many characters as needed before the correct option comes up) and Keyboard Maestro will then happily display Frédéric.

I have also tested this by simply typing Ă© into the Prompt With List field, which also produces no results.

It's an inconvenience more than a pain, and I wanted to ask if it can be corrected easily @peternlewis?

Hey @Rather,

I don't know where you might have gone wrong, but this works fine for me on macOS Sierra 10.12.6 with Keyboard Maestro 8.2.4.

Test -- Prompt with List -- Using Diacriticals v1.00.kmmacros (5.5 KB)

Typing a single accented character like “è” or “Å” also works just fine.

-Chris

Thanks for this @ccstone

Your test macro works on my system as well. Interestingly typing Frederic doesn't call up Frédéric in your list - as I suppose should be expected.

My problematic Prompt With List macro lists from a file rather than a variable, so I put your example words into a text file and revised your test macro to read that file—which it did.

Then I amended your macro to read my own text file (which contains the famous Frédéric). As with my own macro, it failed when I typed Fréd and succeeded when I typed Fred.

My list is stuffed full of personal details, so I will not reproduce it here.

Instead, I have created three dummy lines in your list; two that follow my format, as well as the line +New, which I use to add new data to my file. One of these dummy lines contains the Frédéric. (The data is below)

Now, when I read from a file with this data I have the same issue. Interestingly, the line containing just the name Frédéric can be found by typing Fré and my data is ignored. Conversely, my data can be found by typing Fre and the Frédéric line is ignored.

To complete my test, I loaded this data into your testVar and the result was the same.

You'll see that my data contains an email address, and I thought that this could be the issue, but eliminating the @ symbol has no effect.

Here is the revised data list, the first line is my +New prompt and the next two follow the pattern I am using:


+New
Julie Smith julie.smith@example.com EXAMPLE-FILE LinkedInURLStub-8ab76543
Frédéric Dupont frederic.dupont@example.com EXAMPLE-FILE2 LinkedInURLStub
Frédéric
Ă  la carte
Ă  la mode
Ă  gogo
Ă  propos
abacá
abaká
abbé
açaí
adiĂłs
agèd
agrément
aikidĹŤ
Ă…land
ampère
Ancien RĂ©gime
André
ångström
animé (the oleo-resin)
animēshon (usually anime)
áo dài
aperçu
apéritif
appliqué
après-ski
arĂŞte
art décoratif
attaché
auto-da-fé	bánh mì
barège
beau idéal
béchamel
belle Ă©poque
béguin
bentĹŤ
bĂŞte noire
bĂŞtise
Beyoncé
BĂ©zier curves
biały
Bichon Frisé
bĂ­rĂł
blasé
blessèd
bobèche
bodegĂłn
boîte
BokmĂĄl
bombé
Bön
bon appétit
Boötes
boutonnière
brassière
bric-Ă -brac
Brontë
bĂşn

Hey @Rather,

I still can't reproduce your problem.

Please post an actual macro that you've proven to fail (and any and all files necessary for same).

-Chris

The revised list above, pasted into your test macro, fails on my system.

I’d prefer to get that working first if possible, because it is simpler than mine. I'll then try and apply lesson to my macro.

I understand that you’re able to make my revised list work in your test macro?

For information, I am running Mojave 10.14.2 on a MacBook Pro, Keyboard Maestro Version 8.2.4

This is the revision that fails for me:
Test -- Prompt with List -- Using Diacriticals v1.00.kmmacros (5.8 KB)

Yes.

Safari probably sanitized the text you posted...

The macro you posted does indeed fail, and this is why we need a macro and not just a description.

If I take your word list and open it in BBEdit I find that the diacriticals in:

Frédéric Dupont frederic.dupont@example.com EXAMPLE-FILE2 LinkedInURLStub

Do NOT match the diacriticals in:

Frédéric

Despite the fact that they look alike (by eye).

So – this problem is an issue is of text encoding, and you should be able to easily fix it.

-Chris

Chris,

I appreciate the second pair of eyes on this and the effort you are putting in.

I see what you have discovered; the è from your list is hex E9 and mine is hex 65 - the same as an ordinary e.

In my macro, Keyboard Maestro writes these files to the Finder and then reads them back. This suggests that either the Finder or Keyboard Maestro does a fiddle to display an accented character? Presumably it is the Finder...

Here are two macros, one to write files and one to read.

On my system, the outcome 'fails' in the same way I initially described.

Working Macros.kmmacros (16.7 KB)

Hey @Rather

Not exactly – it's a multi-byte character squashed together in a “decomposed” state.

If you put the cursor at the beginning of the character in BBEdit and start hitting the right-arrow key you'll have to hit it twice to cross the “character”.

The letter is “squashed” together with an appended diacritic

** I don't know Unicode well enough to describe this better.

As far as I can see its the Finder that pulls this little fast one...

If you write “Frédéric” manually as a file name in the Finder and then copy it and paste it into BBEdit, you'll find the same “decomposed” diacriticals.

My advice at the moment is to stop writing individual files to the Finder and write your data to a single file instead.

The diacriticals get properly preserved that way.

image

If you must have individual files I recommend you strip the diacritics from the file names and keep them in the file contents.

This issue was impossible to figure out until I knew you were working with files in the Finder.

-Chris

1 Like

Ah yes, I see the "decomposition" in BBEdit.

Thanks for that embarrassingly-obvious solution!

I should really have done that from the outset - just goes to show how legacy solutions and thinking can still affect today's approaches...