Reopen Finder Windows Like You Can in a Web Browser?

One & two, yes. Not sure what permissions to check.

Tbh I don't think it's likely to be a permissions thing as KM prompts you to set them when need be. Forget I mentioned it. I'm stumped I'm afraid.

In the meantime, I set up a text expander to make it less irksome to keep typing out %Variable%____%. I'll try to remember to use it! I suppose making a macro to prepend it to all variables used in all macros would probably be overkill...

image

I use a text expander for %Variable%___% all the time. My keystrokes are ;var. (that was difficult to type since the text expander kept kicking in :slight_smile: )

2 Likes

I've got a macro that wraps the selected text in the Keyboard Maestro editor in text variable syntax using a hotkey trigger.

1 Like

Sounds like we all do the same thing. I have three Typinator expansions for variables, two that I use all the time are for %Variable%local__% and also %Variable%debug__% which I use when building a macro so I can easily convert them to locals afterwards (got a macro that does that too) and then delete all the debug__ ones.

Look in the variables window and keep an eye on the content of LastClosedFinderWindow and ClosedFinderWindowList.

If it was me, I'd probably open and then close about twenty finder windows, just to populate the variables, then test from there. From the looks of the error you're getting, LastClosedFinderWindow is empty when it shouldn't be. By keeping an eye on the variable contents in real time, you might get an idea about what's not playing ball...

Found a strange issue that I don't think existed when we first had this discussion.

Let's say I open a new Finder window, which defaults to ~/Desktop. This is detected as a Focused Window title change, so my Window Log macro is triggered. Great. However, If I navigate anywhere (for example by clicking on "Downloads" in the sidebar), the window title changes, but it is not detected by Keyboard Maestro. Odd.

Stranger still, if before I try to navigate, I switch application focus away from Finder and then back to it, everything works perfectly.

Any idea what's going on?

Hmmm... I really don't since mine is setup differently than yours. Could try turning on debugging and seeing what's going on though.

There's nothing to debug. KM just doesn't see the title change unless you switch away from Finder and back again, so no macros run.

To demonstrate, I set up a Display Text Large action to show %FrontWindowName%, triggered by Focused Window title changes.

ScreenFlow

Weird, huh?

Hmm...

That trigger works perfectly fine on macOS Mojave with Keyboard Maestro 10.0.2.

What macro group is your macro associated with?

I'm on Catalina, FWIW.

Finder, unsurprisingly.

As you can see it does work, once I've switched away from Finder and then back to it. It's very odd, don't you think?

Try relaunching the Finder.

Opt-Ctrl-Click on the Finder icon in the Dock to reveal the Relaunch menu item.

No difference, I'm afraid.

Evidently it's something particular to my system, as it's not afflicting yours, albeit we're on different OS versions. No idea what it could be.

The big question is whether it's a general problem with that version of macOS or just with your particular system.

Does anything change if you alter the window view to list-view?

I assume the problem persists between reboots also – yes?

Nope.

Yup.

Do you know anyone else on macOS Catalina who can test for you?

Not really. Most of my mates are either on Monterey or don't use KM. I need better friends.

None of the macros above seem to work for me. I suspect is because I have set Finder to always open new windows in a new tab rather than a new window?

Using a third party app is not an ideal solution, though I thought it was worth mentioning that Default Folder X has an AppleScript command to return a list of the most recent folder. Can this maybe implemented for a snappier solution?

Screenshot · Script Editor · Default Folder X.sdef · 2022-05-16 at 16.15.48

This is what Default Folder X developer had to say about this feature in his app:

I must have missed your comment back in May!

Unfortunately, the list returned isn't folders recently accessed by Finder, but those recently accessed by DFX, as you'll see if you run this:

DFX - Get Recent Folders.kmmacros (22 KB)

Macro screenshot

I found another approach to all this on StackExchange. However, the stumbling block continues to be that navigating within an open Finder window doesn't register as a focused window title change, so regardless of the macro, nothing gets triggered. The window title is changing but isn't detected. The issue persists since I upgraded to Monterey, so it's not an OS version thing. Seems like some people aren't seeing that behaviour though, which only makes it more confounding.

1 Like