Adding a dropdown (or choices) to a macro

I tried the Set variable option from KM8 that you gave me the example of and that works great except I'm not getting the results pasted into Chrome.

Thanks again for the help.

No problem, Steve! Is the screenshot you just posted the full macro? If so, there doesn’t seem to be an “Activate Chrome” action in it, so that could possibly explain why it isn’t pasting into Chrome. If that doesn’t seem to be the answer, try posting the full macro and that should give us a better idea of what’s going awry.

I also noticed that you changed the mouse action from a simple double click to a double click and drag. Can I ask what the purpose of the mouse action here is? If it’s to select the Chrome address bar for the purpose of searching Google, I can suggest much more reliable methods of doing that, such as having KM type ⌘L instead of clicking the mouse, or even reworking your macro more substantially to automatically open a Google search URL in Chrome with the selected option without any clicking or keystrokes.

Attached is the full macro.
Chrome is already active when I start the macro, because that is where the "copy" in the beginning is happening.
The reason for the drag is because I am replacing a portion of the URL in the Google address bar, so it starts at the beginning of the word and drags to the end.
The length of the word being replaced varies and sometimes has dashes in it so a double click will just highlight and replace the first portion, up to the dash.

Prompt for User Input.kmactions (0.8 KB)

Thanks, Steve! I think I see what the problem is now. The Switch/Case action you're currently using is set to look for exact text in DAT__Search for:

This worked with Prompt for User Input, but since you're now using Prompt With List, which includes numbered prefixes to ensure the right order, what you now want is Contains:

While this should get the macro working as expected again, I think you would still be better served by avoiding the mouse actions altogether, assembling the entire URL in either the clipboard or a variable, then posting the results in Chrome's address bar (or, alternatively, opening a new Chrome tab with the assembled URL, which would simplify the macro even more). Here's what that approach would look like using the clipboard (new actions have been colored orange and yellow):

Popup Menu Test 1.2.kmmacros (15.2 KB)

This approach would also have the added benefit of making it much easier to add new options to the prompt, since each new option would no longer need a new Switch/Case branch but could just be added to the Set Variable to Text action at the beginning of the macro. Hopefully this all makes sense; as always, feel free to ask more questions if it doesn't!

Yeah, That did it.
I should have caught that.
I actually left it as is and added the numbers to the choices.
So 1) Clipboard, 2) Option 2, 3) Option 3.
I did this because contains leaves room for an error of something that you don’t want.

I’ll look over your suggestions and see if they will work.

1 Like