Apologies in advance if I overlooked something obvious. But I can't figure out how to do the following:
- Initiate "prompt with list" action
- Type something
- Select a list item based on the input from 2.- just with the keyboard (like with "enter")
- Press space
- Continue typing
- Select a second list item based on the input from 5.- (again with the keyboard)
I hope it's clear what I mean. I figured out how to select multiple items by using the mouse. The major drawback is that I would need to delete the search term each time I want to choose a new item. I would prefer to just be able to type, hit enter to select, type, hit enter to select and so until I have a sub list of all the list items. Below is my macro. Any help would be much appreciated!
Tag Selection.kmmacros (3.8 KB)
I think multiple items need to be adjacent, right? Then I don't think that will solve your problem. I think you will need a loop. But a loop shouldn't be too hard. I'll try to write one for you if you want a loop.
I'm not sure if you're comfortable with "double clicking" or not to select items. I think I may be able to fix that too. That way the selection process would be faster.
Thank you @Sleepy
I tried a loop action ("until") without much success. Basically, the until condition doesn't seem to work when I press command + enter/Return
I guess I would gladly take your offer on writing a loop if you could find the time
Tag Selection.kmmacros (4.7 KB)
Edit: from the log:
2022-02-17 16:11:23 Execute macro “Tag Selection” from trigger Editor
2022-02-17 16:11:29 Action 59308 failed: Prompt With List returned without an answer
2022-02-17 16:11:29 Prompt With List returned without an answer. Macro “Tag Selection” cancelled (while executing Prompt With List from Variable “TagsFound”).
I've been working on it and I'm really happy with the results. I'm testing it right now.
Ok, I'm starting the upload process. Bear in mind that my solution may not be what you want. But if not, I can probably fix it. For one thing, I was assuming that you wanted to keep selecting until all the items were gone. Maybe I made the wrong assumption. Maybe I made other wrong assumptions too. If so, let me know.
My solution requires two macros. One is short, and one is long. I'll force you to retype the short one because the short one may depend on what brand of mouse you have. So you have to modify it (to rename the mouse in the trigger), so I'll just post the image here:
I used the right mouse button for the trigger. I haven't actually tested it if the left mouse button would work! Sorry, so start with the right mouse button since that's the only one I tested. It actually seems to work well with the right mouse button anyway.
And I'll post the larger macro here in about one minute.... OK, here it is. If you download it it will appear in a folder called Testbed.
Macro1 Macro (v10.0.2)
Macro1.kmmacros (7.3 KB)
It has a line that creates the list of items. You can replace that line with your own code.
I'm pretty happy that I was able to get Prompt With List work with a single click! I wasn't sure I could do that.
Yup, I just tested it with the left mouse button, and it does work with that too. How cool.
Thanks so much! That's indeed pretty cool! Great work! Especially that the items disappear from the list once selected is pretty awesome!
Just to clarify: I didn't wanted to use my mouse at all. Just the keyboard. I'm also mostly using the Apple Trackpad (either the Macbook one or the external). However, the workflow also works perfectly already with just pressing enter/return
Two questions: Would it be possible to see the list of selected items while still selecting?
Like so: Item1 gets selected. Now the prompt shows: Item1
(above the list of ) Item2, Item3, Item4, ...
Item2 gets selected: Now the prompt shows Item1 Item2
(above the list of) Item3, Item4, Item5,...
And more, importantly, can I stop the loop by just pressing the "escape" button?
I was wondering about "Escape" myself. But I wasn't sure if you needed it, so I didn't think about it.
I didn't think about displaying results as we progress. I can probably find a way.
I really hadn't thought about using the keyboard. Or trackpad. I didn't test that at all. But you seem to be saying that you can manage with the macro as it is. Let's solve the first two problems and go from there.
If you replace the Prompt action with the following, you can get a quick solution to your display problem. However it uses the top window of the Prompt action to display, which means you can't fit more than a dozen items in there. I'll reconsider this idea after I've tackled your second problem.
If you turn off the two flags in the Prompt action which trigger an error, and add the following statement after it, then it works correctly when you press Escape.
Yes, of course I'll post the end result here soon. But I'm still thinking about it. I may be able to improve them before I repost them.
Fantastic! Will check that out! Also I kind of find way to end the loop with a key. It's a bit odd though. Basically, you have to press a key that doesn't produce an input within the prompt line. So, pressing down tab and hitting return does the job. For some reason, however, I can't get this to work with with the modifier keys or the esc key.
Below is the temporary solution
Try my solution for Escape above.
As for displaying your results while selecting, my solution above works only for really short lists. I guess what you want is something that can display the results ON DEMAND for longer lists. Then what we really need is another trigger. All you need to do is create a macro that triggers on a shortcut that displays the interim results for a period of time that you deem appropriate. I'll rig one up right now and post the results in this thread shortly.
Great going @Sleepy, Looking forward to the result with keyboard/trackpad support
Thanks, Neo. Although I'm not sure if I'm even able to write a macro that supports trackpads if I don't have one. Actually, I think I have an old Apple Bluetooth standalone trackpad somewhere.
Let me quote Neo from the movies:
Trinity: "Hey Sleepy, nobody has ever done anything like this."
Sleepy: "That's why it's going to work"
That quote summairzes my approach to problem solving with Keyboard Maestro.
Great @Sleepy! I figured the the displaying part. that's actually already perfect!
I just don't get the escape part. The moment I replace the action below, I can only select one item before the list is displayed (with the single selected item).
I'm going to update the latest version shortly. See what happens with it.
Okay, here's the latest version that allows you to press CTRL-SHIFT-F6 to display the full selected list whenever you want. Of course you should probably change that shortcut key to something nicer. This version also incorporates the Escape solution. And to make it work I had to change LocalAnswer into Answer, to make it a global variable. Try this out, and then ask me for more changes. But I need a 15 minute break to do errands.
I placed it into a new group: TestbedPrompt.
TestbedPrompt Macros (v10.0.2)
TestbedPrompt Macros.kmmacros (16 KB)
For me keyboard & trackpad already works!! It doesn't seem to make a difference between the mouse and them.
Awesome! Thanks so much! Everything works great It's just that the esc key doesn't work for me somehow. What works is that I have to click the trackpad outside the prompt field and the macro immediately shows the selected items.
Same holds true when I press CTRL-SHIFT-F6! Macro 1 then also show the selected items. Maybe I'm doing something wrong here?
Apart from that, everything works really great Thanks so much again for your time and help. And please take all the time to get back to the esc issue!!
I'm happy that you're happy. But I'm unhappy that you're not completely happy. Anyway, I need time to make food and such, so I'll come back later and reconsider the problems.
Haha! Sure! Enjoy! And thanks again for your time and help