I created a macro that will iterate through the files of a selected folder and save a pipe-delineated list in a variable which I can then use to populate a dropdown menu in a "prompt for User Input" action to select the location I will save my project to.
I'm looking for a way to filter the contents by type so that only the Folders (and not files) will be saved to the variable.
Any thoughts on how to do this?
Here is what I have so far
Seems I figured out a way. if you know of a better way, let me know!
You can also use the Action
Get File Attribute to test if the selection is a Folder:
Click to Show Image
Ah!! I knew there was a more straight forward way to do this. Thanks for responding!
One thought is that it is much easier to comment on a macro if you post the actual macro as well as an image of it This may even be a combination of multiple macros, hence the mixture of global and instance variables...
Be careful of using the absence of an extension to determine a folder -- it will break if a file doesn't have an extension or a folder has a period in its name (
My.Folder, for example). Safer to use @Zababon's method, but you can also use an "At this path... a folder exists" as your test. Here's an example that also uses array access rather than "Split" to get the name, and gets rid of the final empty line in your prompt list:
List Directories Only.kmmacros (4.4 KB)
Thanks Nige_S! I had a feeling I was setting myself up for disaster filtering by the absence of the extension. I'm pretty new to all this and still learning way all is possible.
You are correct that this is just a portion of a much bigger macro I've been putting together. I'll learn how to post macros next
I like your way too. I have my actual macro set up with an "add new Client" field under the "Client" field in the user prompt so if I have the empty slot selected in the dropdown for "Client" it passes the data from the "add new client" field into the Client variable.
Once I get my full macro up and running I'll be sure to post it.
Thanks for taking the time to respond!
An "interesting" UI choice... Maybe make it more explicit by making the last, currently blank, line read "[Add new client]" or something? Your future self will thank you!
And you could then miss out the (possibly frequently redundant) "Add new client" field from the main dialog, instead throwing an extra "Add client" prompt whenever "[Add new client]" was selected in the main dialog.
But there's many ways to approach this -- pick whichever suits you best.
not so much interesting as just not very good at this stuff yet! I'm flying by the seat of my pants over here and just happy when it does what I want at all.
But I took your advice and put the "Add Client" selection into to dropdown and now a second prompt pops up to take all the client info when it's selected. That definitely cleans up the UI. Thanks for the suggestion.