Back Out of Current Folder to Its Parent Folder

Hello All,

I hit a bit of a roadblock. I am continuing to work on my "DAMn Finder" set of macros. (Digital Asset Manager I(n) Finder)

I am attempting to create a macro that backs out of the current folder to it's parent folder.
Similar to the Back command of the OS. (CMD-[)
However, the difference is that it doesn't care what historical path the finder took to get there. It will just go to the parent folder regardless. Think of if that finder window were opened directly to where it is with no history of getting there.

I can mostly get it to work with the attached Macro. However, I want the new location to be in the same window. Not to open a new window. (that could be it's own.

While I suppose I could do what I want to do through the UI control, the problem with that is, I have these windows too narrow to click on the Window name to get the path dropdown.

I realize that this is probably a pretty clumsy way to go about what I want. But it is working up to the point of backing out without opening a new window (or activating another window if that location happens to already be open). (I Bet I should manipulate the string in one go instead of "Get Parent to Variable". Multiple times. That nuance can be saved for another day.

Cheers!

Ñ

AbsoluteBackout.kmmacros (5.1 KB)

If going up a couple of levels in the folder hierarchy while working in the Finder is all you need, I suggest the Finder's Enclosing Folder command (⌘↑). In my experience, it works no matter how you got to the current folder. And typing ⌘↑ a few times in a row is very fast.

But if you need your current Finder window to go up a couple of levels as part of a more elaborate macro, try adding an Execute AppleScript step using a variant on this AppleScript,

tell application "Finder"
	set currentFolder to target of front window
	repeat 2 times
		set currentFolder to parent of currentFolder
	end repeat
	set target of front window to currentFolder
end tell

where you can change the number in the repeat line to whatever you need.

1 Like

Dr,

Gosh, and here I thought I was a power user. I was unaware of that as a hotkey. Turns out, I do not need to make a macro for this functionality after all!

Many thanks!

Ñ

1 Like

I've been a super-user for nearly 40 years, and even I don't know (or remember) everything.

I knew this one though.

:sunglasses:

1 Like