In his first sentence he says "his sidebar items disappear" and then in the same sentence he says "his Findbar window tabs disappeared." I know these are different things, but my suspicion is that both of these phrases are referring to the sidebar items. The reason I think that is because my sidebar items also disappeared a few days ago. Not my tabs.
In any case, your response was only about the "tabs." Do you have any advice regarding his first issue, the sidebar items?
I believe this macro by @ccstone does exactly what you want:
This is nostalgic. Recalling Finder "sessions" was one of the main reasons I started using Keyboard Maestro to begin with, and looking for that macro/thread was one of my first ventures into this forum. Christopher mentions the macro is slow and perhaps that was the case on macOS Monterey, but it runs fast on my system (Sonoma, M1 Ultra): a set of 2 windows with 5 tabs each takes about 2.5 seconds to load.
It does. I just tried it and it works. But I have a question about the needed folder settings.
If you are in a folder, how do you quickly grab the locations in the format shown? For example, Downloads on my Mac is in Macintosh HD > Users > admin > Downloads
Is there an easy way to grab the location in the format needed by the macro?
(This would make the second macro I've used in Keyboard Maestro so far.)
Deselect any selected items while inside the folder OR go up one directory level and select the folder you want to copy the path of. Then click the Edit menu and, while holding ⌥, select the newly enabled Copy "Folder" as Pathname menu item (or, alternatively, use the keyboard shortcut ⌥⌘C);
If your Path Bar is not visible, make it visible by selecting Show Path Bar from the View menu. Then right-click the folder you want to copy the path of and select Copy "Folder" as Pathname.
I was trying this option. But the copied format is different from in the samples. Instead of ~/Documents, for example, it copies /Users/admin/Documents.
In answer to my own question, while I don't know why it doesn't get copied as ~/Documents, /Users/admin/Documents works just as well. But I guess only for my system - ~/Documents is probably more general.
It seems to just add tabs to the current Finder window though. I wonder how to make it open a new Finder window with the specified tabs.
In Unix systems, tilde (~) can be used to specify the current user's home directory in paths. So ~/Documents, ~admin/Documents and /Users/admin/Documents are all equivalent paths. Since ~/Documents effectively means "the Documents directory located inside the current working user's home directory", this means that it works on my system, as well as yours, or anyone else's (assuming of course that a Documents directory exists inside that specific user's home directory). This is why Christopher chose to write those paths that way, so his macro works "out of the box" for most people, since most people will have those directories located inside their user's home directories.
You probably have a Finder window open with a tab that matches the first item on your path list, and that tab gets focused upon executing that macro. You will notice that if you close that tab, a new window will open instead. This is because of how the AppleScript that the macro runs works: if the first path in the FolderPathList variable (the first path on the list you edited to include your own paths) matches an existing Finder tab, the open item 1 of folderPathList line will bring that tab to focus instead of opening a new window. All subsequent items on the list are then opened as new tabs within that window.
If you change that line to make new Finder window to item 1 of folderPathList, this ensures a new window is always created first instead. Here is Christopher's macro with the revised code:
You can also drag'n'drop a file or folder from the Finder to a KM action's text field to insert the full path to the item, or drag in the proxy icon from the window's title bar.
You may need to pause a beat while over the text field so that it activates -- if you go bit fast you'll get a new "Open" action pointing to that location instead (possibly a quick tip in itself!). That action will have the path in the abbreviated form, so you could always deliberately add the action, drag'n'drop the abbreviated path from there to your variable, delete the action.
Hi, @douglerner. Looks like you have a few options to consider.
Following up on my suggestion, if you download and install Finder Assistant as I suggested above, you can call the subroutine with the folder paths of interest. In the example below, a new Finder window will be opened and positioned (even if another Finder window is already open), and four tabs will be created.
The subroutine includes other features that you can read about in the header comment of the subroutine, not the macro below.
The only reason I didn't try that solution yet (I hope to) is because I'm such a complete KM novice and that solution looked overwhelming.
In your new attachment (1) is that all that's needed to run it or is the complete Finder Assistant library needed and (2) is it easily modified to do more than 4 tabs?
Hi, @douglerner If you have another approach that is meeting you needs, the approach I'm suggesting might not be worth your trouble. But...
Technically you wouldn't need all of the subroutines included in Finder Assistant, but the simplest approach is to install them all.
In the post above, the example macro calls the Finder Assistant subroutine 𝗌.𝗳𝗻𝗱⇾NewTabOrWindowInSpace four times. That sub then calls other subroutines in Finder Assistant, but there's nothing you need to do if all of the Finder Assistant macros are installed.
If you look at the example calling macro above, I suspect you'll know how to revise it for your needs. But if not, feel free to ask. Or again, no offense whatsoever if you don't want to pursue this option.
In for a penny... I installed Finder Assistant. It was quite easy with your instructions. I'm not sure what it all does but it installed correctly.
Then I installed your Open New Window With 4 Tabs.kmacros, moved it into the Finder Assistant group and enabled that macro (all new terms to this novice). I tried it and the four example folders opened as you said, in a separate window.
It's not necessary to move the calling macro, Open New Window With 4 Tabs, into the ⋮Finder Assistant group. In fact, I suggest you move it to one of your other macro groups (or to Global Macro Group) since it's not part of Finder Assistant; instead it's just leveraging the subroutines within.
I think I understand your comment, but just to make sure it's working as I expect...
You got one new window (with four tabs), not four windows, right?
You're welcome!
As you are playing, you might want to refer to the magenta header comment at the top of sub 𝗌.𝗳𝗻𝗱⇾NewTabOrWindowInSpace (located in the ⋮Finder Assistant group).
Also, feel free to ask follow-up questions.
BTW, I use 16 Mission Control Desktop Spaces on my MacBook Pro. Space within the sub name, 𝗌.𝗳𝗻𝗱⇾NewTabOrWindowInSpace, is referring to the currently open Mission Control Space. If you use only one space, then the reference in the subroutine name is moot. (If I've just confused you, ignore this paragraph. )
I moved the macro into Global Macro Group, renamed it "Open New Window With My Tabs" and defined my current 7 tabs as the ones to open. For some reason it's not as speedy at that first macro I tested, but that's not to say it's slow at all. But it does seem to take a second for each tab. Still - this is a recovery macro, so that's fine.
The Finder window that opens is quite narrow. Can that be adjusted? Of course I can just drag it wider after it opens.
When pasting in the folder directory into each NewTabOrWIndowInSpace dialog I thought the paths were getting truncated at first. But I saw they were all there. It just wasn't obvious at first.
In answer to your question, yes, it's working as expected. I got one new window with just the specified tabs, not four windows.
I'll take a look at the sub macro you mentioned.
I will ignore your desktop spaces comment for now. I have one external monitor, but I think everything's in one space.
I wonder what would make a good keyboard shortcut for this that wouldn't trample on everything else. Right now I'm opening up KM and clicking the Try button to execute it.
The WindowArgs I specified (0% 0% 50% 75%) worked well on my 16" MacBook Pro, but if you have a narrower display, you might need to increase the width.