This seems so simple. I must be... (I'm not going to say it!)
All I want to do is open two folders in the same finder window. But no matter what I try finder insists on opening two windows. Manually I can select "New Tab" and accomplish this simple task. Why can't I do this with KBM?
It's not clear from the built-in options for using tabbed windows how to get one Finder window with two tabs, but user @Zabobon described the necessary settings and showed an example macro for this a couple months ago:
Unless I misunderstood the problem, which is entirely possible, I was able to do it as follows. In this example I used three folders, not two. And I have a folder called ~/data which you may not have.
The pause actions were required. Apparently the Finder app is too slow for KM.
Airy's solution works great, but I wish to know if it can do more.
What I find is that while the macro opens the Finder and sets the three tabs as desired, if I happen to invoke the macro again while not realizing that Finder already has these tabs open, they open again giving me six tabs each in duplicate and then nine tabs in triplicate and so on.
Here's the macro I created using Airy's suggestion:
I have tried adding these to the top of the macro without success:
I've also added various pauses without success.
How can I make it so Finder only displays the three folders I want regardless of the current Finder situation, i.e. not open, already open with these desired tabs active, open with some other tabs active, or even open with a mix of these tabs and other tabs active?
Sorry for not replying earlier. I didn't include this in my original post because I wanted to keep my original answer short.
There is a menu command in Finder that lets you close tabs in Finder. We can use it, as shown below, to close all existing tabs (but it won't close the last one, which we want to keep anyway). The following action works fine if you insert it below the "Activate Finder" action in the screenshot I gave you, above.
Now to discuss a finer point. Notice the Pause statement. I have found that if I keep the value 1.0 seconds or higher, the window will remove all the tabs except that last one, which is the behaviour I would desire, albeit it's too slow for humans to watch. (If this macro runs when no humans are present, it may not matter to you.) However if you lower the value to 0.3, it will remove all the tabs including the last one, which is okay because the remainder of the macro still works perfectly. However if you lower the value below 0.3, it will close all the tabs and then make quite a few beeps due to the action occurring faster than the macOS GUI can process. Now your computer may possibly require different values, I'm not sure. You may have to experiment with the best value for yourself.
HOWEVER, if we get rid of the animation, we can probably lower those values, which may be what you want. Or maybe you like the animations and don't want to cancel them.
I'm not sure if different Macs would need different Pause durations because Apple probably makes the GUI respond at a fixed speed regardless of how fast the processor is.
Another thing is this macro, and some couple other KBM macros I run seem to make me depress the hot key several times before they work. Then they work okay. My MacBook is just last year's, so kinda new. Why would I ever need to call for a macro via hotkey more than once? There is nothing wrong with my keyboard. I type notes, emails, and letters on it all day long with no hiccups or gaps or any kind of problem. It's just KBM macros.
One cause of that problem is that when you are editing a KM macro, it takes a few seconds before the macro is available for use. That has something to do with the KM editor's time to save. I can't tell if that's the problem you are having, but it's a problem I have every day, and I just get used to it.