Dynamic Default List for Prompt for User Input (Example)

MACRO: Dynamic Default List for Prompt for User Input (Example)


-~~~~~ VER: 1.0 2016-07-20 ~~~~~

DOWNLOAD:

Dynamic Default List for Prompt for User Input (Example).kmmacros (9.1 KB)


Author: @JMichaelTX

PURPOSE: Show How to Use and Maintain a Dynamic List for Prompt for User Popup Choices

The Prompt For User Input provides for multiple choices in the default value for a popup field. However, it is a bit tricky to set this up to use a KM Variable for these default choices.

The below macro shows how to use a Variable for the popup default, and how to maintain this this variable, appending new items when needed, that will automatically show on the next run of the macro.



Example Output

2 Likes

Huh. I do this in a lot of places. Didn’t think about posting it, but probably because it’s tightly integrated with the rest of my code.

Thanks for posting this - I’m sure lots of people will appreciate it.

Yeah, it is simple once you know how, but can be a challenge in the beginning.

This macro was prompted by this request:

When he get’s done, it will be another good example of this, because it also shows how to check for a selection when making a copy.

2 Likes

I like this.

So, here’s a challenge. I have a macro and a group of macros: The macro prompts for info about a billable time event (when, what, client) and then builds the entry in Fantastical. The group of macros I use in other contexts that is merely a long list of task names – each macro in the group uses the same string as a trigger so I can choose the tasks from a conflict menu.

I’m thinking of using @JMichaelTX’s concepts above, and would like to build a “maintenance” macro that takes all of the task name macros from their group and builds %Default_List%. It’s OK if %Default_List% is rebuilt every time I run the “maintenance” macro.

Any thoughts about how to make a string out of the names of all the macros in a group? Oh – and in that group each name is prefixed by a numeral of a letter, for operating the conflict menu – so I want to strip the first 2 characters (numeral/letter and space).