Prompt With List... On Steroids! πŸ’ͺ🏼

NICE~
yeah, yes, working now that I turned off "Failure Aborts Macro"!

Next =)
Can I get all files to show that are in sub-folders of the 'Parent' folder?
Or do all the files need to be at the top level of "Local__ParentFolderPath"?
Not really a big deal, I could move all the files into a single folder if that's the easiest way.

Thank you much to both @noisneil and @Nige_S !!

NOTE:
I tried to get it to show a 'Smart Folder' contents and it didn't, no biggie, just reporting.
Seems the best way would be to put all the files in a single folder.

Consider that a troubleshooting step -- @noisneil's put that sub in for a reason, so I suggest you start at the top of the thread and download all the relevant bits of this prompt system so it works as intended. If nothing else you'll then be on the same page as everyone else for future troubleshooting and feature requests.

1 Like

Hey Troy it’s me again … if you distinguish between files and folders in your loop you could leave your filesystem as is and solve it with nested loops

Greetings from Germany :de:

Tobias

1 Like

Last ask? I promise....

It's working great, I moved all files to a single folder, it displays correctly.

How do I filter out ' conversation ' from the display name and have it still open the file?
All the files start with ' conversation ' so it would be great to display the filename without that at the beginning.

cheers, really

Once again, workflow has completely changed for the good! WOOF

Maybe consider search for this substring and replace with nothing before building the Textline for the prompt will do the trick …

Tobias

A simple "Search and Replace" should do it. Shown between two of the actions already there, and using %Space% tokens to make the spaces more obvious:

DOUBLE WOOF! =)
Crazy powerful for me to be able to use this....

Working like a charm, thank you all again...

2 Likes

Nice one @Nige_S. I didn't consider that @troy might not have downloaded the dismissal submacro. :clap:t3::clap:t3:

Yes:

3 Likes

Dang !! I totally forgot about this option … 4 months of not doing any Macro dev and even nearly not doing anything on my Macs carries fruits …

Thanks for reminding me of that Neil !!

Troy (@troy) - if you want to solve this without navigating into subfolders this is the way to go … otherwise you maybe will have to consider my solution with nested loops and separation of files and folders.

Just as a reminder for the future…

And by the way congratulations to your working Macro :wink:

Greetings from Germany :de:

Tobias

2 Likes

Great work! I'm jealous. :stuck_out_tongue:

EDIT:

As I posted below, I was able to add an option for pre-selected items, so you can just ignore the rest of this. I'm good to go. Thanks!


I haven't read through everything here, but a couple of three questions:

  1. Can I pass in a list to show what items I'd like pre-selected? For me, this is a must-have - which doesn't make it a "must-do" for you of course.

  2. Can I toggle the sort between the order I passed things in, and alpha, and back again, while the prompt is running? Not a must-have, by any means.

    • If not that, how about the ability to add user-defined button(s) to the bottom of the window? That way I could click on a button, it would close the window, then I could re-sort and open the window again.

    Again, not a must-have.

  3. Can I pass dividers? I'm not sure whether I would use them or not, but it's a thought I've had. I wouldn't waste too much time on this, or any time at all.

All-in-all, it sure looks good to me. :facepunch: :man_bowing: :sunglasses:

1 Like

I was able to add an option for pre-selected values. So I'm thinking you don't need to spend any time on my other comments.

Thanks!

1 Like

That was quick! If you improve on it, please do share! :+1:t3:

EDIT: Forget what I wrote here previously - I'm an idiot. Here's the changes tht actually work:

All I did was add a subroutine parameter called Local__PreSelected Values, then added 1 small bit of code to the html prompt. Here's what I added, with surrounding lines for context. Just look for the code between the "dwt" comments:

...
    // Add the created list item to the list.
    list.appendChild(li);
}

// dwt added
var somethingWasPreSelected = false;
var preSelectedValues = KeyboardMaestro.GetVariable('Local__PreSelected Values');
if (preSelectedValues) {
    preSelectedValues = preSelectedValues.split(/[\n,]/);

    Array.from(document.querySelectorAll('li')).forEach(item => {
        if (preSelectedValues.includes(item.dataset.fullText)) {
            somethingWasPreSelected = true;
            selectItem(item, true);
        }
    });
}
// dwt end added

// Mark the first item in the list as selected.
// dwt added "if"
if (!somethingWasPreSelected)
    list.firstChild.classList.add('selected');

// Add event listeners to handle input changes and keydown events.


Simple enough. especially since you did all the hard work! (Thanks again.)

3 Likes

I'm an idiot, and the code I posted didn't work. :face_with_symbols_over_mouth:

But I just updated it with the correct code, which I'm reasonably sure works correctly.

2 Likes