Variable from list

I'm building a macro to open 15 tabs in OmniFocus, and assign 15 different perspectives (reports) to the tabs.

I'd like to make a list of the names of the perspectives, and then use a repeat action with a variable to open a new tab and select the next perspective from the list using the variable.

How do I make this work? Can I use a pipe-delimited list for this?

Yes, you can use any delimiter you like. For example:

Delimited Text Example Macro (v9.0.4)

Delimited Text Example.kmmacros (2.8 KB)

1 Like

Thank you -- how do I increment which value in the list it uses?

Please see my comments in this macro image:

Like this:

Delimited Text Example Macro (v9.0.4)

Delimited Text Example.kmmacros (5.1 KB)

You could accomplish the same thing with your text formatted with the entries as separate lines (i.e., with line breaks), then use a Lines collection in the For Each loop. The reasons I used custom delimited text is because you asked about it, for one. But more importantly, I wanted to point out that the nice thing about delimited text is that you don't HAVE to use a For Each loop to access all of the entries. If you know their positions, you can access any one of them at any time from the delimited string just by referring to the correct index, either as a constant value (like 2) or as a variable that contains that value.

1 Like

Thanks very much. This has been quite illuminating.

Here is the final macro, and I'm happy to report it's running smoothly. It looks at a list of reports, then makes a new tab and selects the next report name. To change which reports are opened in tabs, I just change the list.

Open tabs test -- lines in variable.kmmacros (3.7 KB)

1 Like

Excellent, and you're quite welcome for the assistance.