Preserve Order Selection in Prompt List with Multiple Selections

I'm not sure how much of a need this is for others, but I have found that on a few occasions I've wanted to preserve the selection order in a Prompt with List action. For example, if I have a list with:

1
2
3

I select 3 first, then 1, then 2 so it returns to the variable:

3
1
2

Right now if I select all 3 it returns 1, 2, and 3 in that order regardless of the order I selected them in. I think it would be a nice option to at least have in the gear menu to preserve the order of the selection, if possible. In the meantime, if anyone has a workaround I'd be interested in hearing it.

Part of the problem with that idea is that there are ways to select multiple entries without any concept of "the order of selection." In that case, what would KM do if you selected three items all at the same time? What's the order going to be when there is no order?

If your idea isn't implemented, I think there are ways around it. One way is to disable the "allow multiple selections" flag and then each time the user selects an item, remove that item from the list and present the new list with the remaining selections. (Do you need help coding that?) The problem with this idea is that the user has to double click to select an item instead of single clicking. Maybe you don't want that. But there's a way around that. It's possible to use a Custom HTML action to let the user single click on a list of items, and the order can be preserved. I suspect that such an action could be made to look a lot like the Prompt with List action, if you want that.

Good point...I wasn't sure if my idea was even feasible, only that it would be nice to have. How I would make my out-of-order selections is by strictly using ⌘+Click and ⇧ ↑|↓. I was thinking along the lines of how Finder works with selections. If I make an out-of-order selection to encode video files, for example, Finder will encode the video I first selected, then the second, and so on in the order I selected. I suppose if three items are selected at the same time, then it just uses the default top-down order, and if anything is selected one-by-one it would be in the order of selection. That's how I'd want it to be anyways.

This is a clever workaround and you've given me an idea, although when I was trying it I thought it was better not to disable multiple selections, at least for my use case. I select item 3 first using the prompt modifier βŒ₯, the same list comes back up since it's in a loop, and I can then select both item 1 and 2, then afterwards prepend item 3. I can foresee a problem with more selections, although I don't think that matters much to me right now. But let's say we have 5 items, I want to first act on item 5, then 1, then 4, then 3. I use βŒ₯ on item 5, then I could select both 1 and 4 using βŒ₯ again which appends it to the variable item 5 is in, then add 3. That's all a bit inefficient so I don't like it much, but for what I need now your workaround works well, so thanks!

Lastly, I don't think I want to take the Custom HTML route...I was just looking to preserve the order of selection by using the native Prompt with List action.

This does that:

That's funny...I tried your prompt list before making this post but it didn't work. I didn't think to check the post again...turns out I have an older version of your prompt that didn't have that option. Awesome man!

I just updated the posted macro with my current version when I saw your issue. Glad it's solved a problem for you!

ahh okay! Good thing you posted the updated version. Two slight issues testing it out...if I use shift down to select everything works as expected...if I shift up it's not in the correct order. However...if I first shift return then shift up it's in the right order. ⌘+Click works as expected. Secondly, I'm using a workaround that @griffman had posted somewhere that allows double underscores to be displayed in the prompt list. So my list basically looks like this:

1__Some Text__some more text
2__Even More Text__and some more

The native prompt correctly displays the full text after 1__ and 2__ whereas yours I get:

Some Text
Even More Text

Also, this doesn't break the macro...1 and 2 are correctly stored in the variable...it's only the text in prompt list that I can't fully see.

Anyways, glad you changed the look of the prompt, it looks very nice...I might just have to change some of my most used macros to use your list instead :+1:

Two very good catches, neither of which I ever noticed!

I've updated the macro now with a fix for each!

Awesome! Everything works...looks like I might have to be taking Prompt with List Steroids from now on!

Thanks for your help...I appreciate it :wink:

You'll get PSWOLE in no time! :muscle:t3::muscle:t3::muscle:t3:

haha that's sure to be me in no time. If I may trouble you for one more thing, if at all possible. I do like the feature of pressing β‡§βŽ in order to select multiple items, especially in the current macro I'm constructing, so I would not like to do away with this feature. However, in many of my other macros I would like the option of disabling this so that I can use the ⇧ key as a modifier to perform subsequent actions on my selection, as it is not as beneficial. This would be a very welcome addition, as I'm sure it would be for others.

In the meantime, I must say I'm really appreciating the fact that I can now use the βŒƒ modifier with your prompt to perform subsequent actions, as it does not trigger the context menu like it does in the native prompt list. I know I can disable this in system settings, but I do like to use the context menu shortcut from time to time...just never in a prompt list :stuck_out_tongue_winking_eye:

Perhaps I should have posted this on the PWLOS thread...but I'm not sure if I can just move this.

You know what makes a lot more sense than ⇧↡ for marking list items? The key that's right under your index finger when you're using the ↑/↓ arrows to navigate:

←

I've switched it over and added a comment with some tips on how to use the macro. Oh and I added a new icon just for fun too. :nerd_face:

Brilliant! That's much more intuitive and frees up the ⇧ key. And I couldn't have thought of a more fitting icon than the one you've chosen :face_with_hand_over_mouth: I'll have to add it to your Icon Manager macro for safe keeping.
For the longest time I've had your KM Subroutines Icon as my KM Subroutines Group Icon...I think it's just as fitting lol

image

Anyways, I sometimes use SF Symbols like this one τ€š€ as descriptors in my prompt lists and they were showing up before in yours but they no longer are in this latest version. And I see the symbols don't render here either...but that's exactly what I'm seeing is just a box like that.

What is Prompt Font set to in the caller? Try setting it to system-ui, which supports SF Symbols.

ah of course! I had changed the default font in the previous versions and simply forgot to do so in this version. Thanks again!