I have a shortcut that asks for text and then runs off to my mail server to do some searches of that text. Since the text is passed to grep, I want it to be constrained to a single line, but the ask for input action allows free form text. This also means that “Return” doesn’t submit the text. Is there a better Where are you?
Also, when setting up a dictionary and then choose from list, it shows both the key and the value. How could I just show the key? Can I create a separate list to choose from that is then mapped to the dictionary in a way that isn’t visible when the shortcut runs?
So if you use Ask When Run you and the right action you can restrict to one line. Similarly you could ignore anything but the first line, for scripting change newline characters into command concatenations, etc. The issue is the dismissal via the ‘Done’. There’s no option in the app unless you are using an external keyboard in which case you can use CMD + RETURN. Otherwise I think you’d have to spawn out to another app to do you single line of capture with just return to return the data.
As for just listing keys from the dictionary, you can do that like this.
I tried that, but then the action gets passed the key, and not the value. I want the shortcut to let me choose based on the key, but then pass the value.
That is to say, taking what you wrote I have a working shortcut that does what I want, but I don’t know why {Get Variable %Dictionary%} makes the whole thing work.
The Get Variable use of Dictionary is actually the use of a magic variable. I didn’t assign the Dictionary to a variable using Set Variable or Add to Variable. When specifing what variable to use in the Get Variable, I used ‘Select Magic Variable’ to select the action output directly.
If you were embedding a Dictionary Magic Variable with key selection into say a Text acion then you wouldn’t be able to dynamically specify the attribute - i.e. the key name; as you have to specify the attribute name as a text string, not as any type of variable.