For Each Loop Over Directories

I am seeking advise on how run a given macro on a bunch of distinct directories.

For arguments sake let’s call these directories ~/directory_1, ~/directory_2, ~/directory_3 and ~/directory_4.

So I was hoping to do something like:

For Each Item in "directories" Execute Macro

It appears that For Each only works on collections.

Is there an easy way to set this up? I do see I can fill variables or dictionaries with JSON which has those directory names but that looks rather cumbersome. Am I missing something obvious?

There may be more than one way to solve your problem. The best solution may depend on the rest of your macro, but based on what you've said so far here's what I suggest:

image

I've made assumptions that caused me to choose this solution. For example, I assumed that your directory names were known in advance. If not, let me know.

1 Like

This works. Thanks.

Never thought about the fact that text can have multiple lines.