I’ve been reading what I can and still need some help with buttons in the Prompt for User Input action and figuring out what can be accomplished in them.
I see that you can create more buttons by typing whatever the heck you want to in a new button field after clicking on the green plus to add a new button, but how you tie that to an action or a way of populating a Variable is something I can’t figure out. I read somewhere that buttons other than OK and Cancel populate the “Result Button” variable when pressed, but is that the ONLY variable you can use with additional buttons? I’m fairly confused.
Now let me ask about a specific example in the hopes that it will help outline what I’d like to be able to do with buttons just as an experiment to help me learn about them.
I have a variable called “Instrument Category” and it has options that I can populate it with. They are Guitars, Drums, Piano, Vocals.
I would like to create a macro that pops up and, using Prompt for User Input asks “What instrument are you recording right now?” and allows you to push the button corresponding to the instrument you desire, and have that choice populate the variable “Instrument Category”
@DanThomas has showed you how to do this with buttons.
Here is another approach using a popup menu which might work better if you want to take advantage of having a default value remembered from the prior selection:
In this Action, your use the "Instrument Category" variable so it is automatically set to whatever the user chooses in the popup menu.
The next time you run the macro, it will default to the choice picked previously.
Not exactly what I meant. If the options are Guitars Drums Piano Vocals and each of those words has a button, let’s say a user pushes Piano. The next time the macro is run to change it to something else, is there any way to have the Piano button highlighted in blue to show that it was the last-used choice?
But there is no easy way to set the default button conditionally. The best I can suggest would be tediously setting up the Prompt action once for each possible default button setting, and using a Switch or Case action to select the desired Prompt. Tedious and error prone.
Thanks @ccstone and more questions for you or @peternlewis : Screenshot of an example simple macro I'm playing with to learn attached.
As is, if I hit the Escape key after bringing up this prompt, it triggers the "Top" button instead of the Cancel button and thus inputs Top into the variable. How do I ensure that the hitting the Escape key properly accesses the Cancel button?
I read about it online and tried setting the Cancel button to exactly "/.Cancel" but that just put those characters into the GUI.
Also, I tried what Peter said to use a / to make one of the buttons the default by making Top into exactly "/Top" but that doesn't work as well.
If all you want to do is indicate which one is the last one used, you could do something simple like adding an asterisk to the beginning of the text. It wouldn’t cause it to be the default, but it would give you a visual indication of which was last used.
If you want to do this, you’ll have to have all the button names come from variables, and when you test “Button Result” you’ll want to test it against the variables, not hard-coded text.