Prompt for User Input Using Populated Variable

Hi, I've got an AppleScript that gets a list of all the audio interfaces on my computer and fills a KM variable with the list, so far so good. I then want to pop up a prompt with a drop down menu so I can select an interface. but I can't get this to work.

Prompt for user input action - If I leave the default values blank, instead of using the values that are in the variable it overwrites it with nothing and I get an empty drop down menu. If I put %Audio Device List% in the default value section it puts all the contents of that variable in one line, rather than as a menu I can choose from the drop down just has one item with is the whole list in a line.

I've tried various different text item delimiters in my AppleScript, so the options in the variable are separated with "|" or "," or ", " and also with a return "\n" none of it seems to work.

I can get it to work if I use a return as the text item delimiter and the use the prompt with list from variable action, but I'd really prefer a drop down list if possible.

Thanks

For the Prompt for User Input action, the variable should contain the list of options, separated by a vertical bar (|).

As described in the Help (which you can get to from the Gear menu in the action):

The default field is a token text field, so you can include variable options in your list, for example: β€œ%Variable%First Choice%|%Variable%Second Choice%”. If you want to provide a list in a variable, then you do so by starting the field with a bar (β€œ|”), followed by your list (or your default value and then your list) in a variable (which contains choices separated by |), for example β€œ|%Variable%Current Choice%|%Variable%Choice List%”. Without the leading bar, the entry is separated by bar first, and then token expansion is applied to each field, so that fields may contain bars, for example, β€œThis|That|%Variable%One Entry%”.

image

3 Likes