Open the Most Recently Closed Finder Location (Tab or Window) With a Keyboard Shortcut?

Below is my failed attempt at making a macro to reopen the last closed tab in Finder with ⌘ + ⇧ + T

Any help in finding out why it doesn't work would be greatly appreciated.

Script was borrowed from here: terminal - Open the most recently closed Finder location (tab or window) with a keyboard shortcut - Ask Different

Here's a short video of current behavior: ScreenFlow-15-05-2022_12-44mp4 · CleanShot Cloud

Reopen Last Closed Folder.kmmacros (4.5 KB)

Looking forward to trying this when I get home!

We had a discussion about this a while back.

I'm assuming your video shows "I open/go to a folder, close it, then straight away try to reopen it and sometimes it doesn't work?" (It all went a bit quickly for me!)

plist files don't update instantly -- preferences, including the Finder prefs you are pulling "last folder" from, are cached and then written to disk a little while later. You can see this in action by taking the AppleScript in you action into Script Editor, adding the line return itemNames immediately after the "System Events" tell-block ends, and running the script to get a list of recent folders. Open a folder that isn't on the list and immediately run the script and you'll see the list of names doesn't change -- if you repeatedly run (Cmd-R) you'll see the new folder name added after a few seconds.

If your problem is something else, try describing it here so we can read it while watching the video.

My bad. Didn't see the post while searching on the forum. Happy to have the topics merged, if necessary.

@splitpersonality I wasn't pointing it out to make you feel bad. :joy:

I just thought maybe there might be something in that thread that could help you get yours working.

Thankfully, it takes way more than that to make me feel bad. :joy: Just being polite! Thanks for mentioning it.

You got it. Should have held back with the hot keys though, things happen at light speed on my mac or nothing! :joy:

This makes a lot of sense. As the behavior seem in fact to show some kind of delay rather than failure. I haven't wrote the script. So, can't comment on the ins and outs of it. I am surprised such a simple feature is not built-in neither in Finder nor in Default Folder X...

1 Like

Which implies it either isn't as simple as we think, or that they've decided it's of use to so few people it isn't worth the work!

1 Like