Open Folder Not Working

I have a simple folder opening macro that isn't working:

  • Open “~/Documents/Templates/ Label Templates”
    With Finder
    Stop macro and notify on failure.

Instead of opening the folder Label Templates, it takes me to my User folder (
~).

I'm suspicious that this may be related to a non-KM issue. When I add a folder to the Finder toolbar (which I've used for years in the past), clicking that folder takes me back to my user folder instead, unless the folder is also in the sidebar.

Hey Stephen,

Hmm... This works fine for me on my macOS 10.12.6 system:

Open a File- Folder or Application.kmactions (626 B)

Have you rebooted?

Have you booted into your Recovery Partition and run Disk First Aid?

-Chris

"~/Documents/Templates/ Label Templates"
Could it be because of there is a accidental space in front of Label where only "~/Documents/Templates/Label Templates" folder exist.

Bingo!
For that folder at least, that was the problem.
I often use leading spaces to force folders or files to the top of a Finder list.
I will check that out to see if it's a general problem with Finder Toolbar and aliases.

Oops. That only worked one time.

Yes, all of your suggestions. No help.

The KM Open command seems to be working consistently once I changed the folder name.
There's something mysterious going on.
Even the Finder's Go to Folder won't work if the folder name has a leading space. Is that new in Big Sur?
And I still can't make Finder Toolbar folders work whether or not the name has a leading space.

Hey Stephen,

Something weird is going on with your system...

I experimented using a friend's Big Sur machine and didn't have any problems with your test case.

Not with Keyboard Maestro – not with the Finder toolbar or sidebar.

Have you tried creating a new user and testing with it?

-Chris

1 Like

Good idea. There's definitely something going on with my iMac. I'll check on my up-to-date MacBook first.

Thanks for all your suggestions.
My problem was not related to KM at all.
I trashed the Finder plist file and restarted. Voila, problem solved. The KM open folder shortcut worked, and all Finder Go to Folder operations worked too.

As I reestablish my Finder preferences, if I find something that causes the problem, I'll report back...
Later: I can recreate the problem with paths if I delete Documents from the sidebar. With Documents in the sidebar, everything works. Keeping fingers crossed.

Now if I can figure out a simple way to open a folder in the Finder without opening a new window..

You mean you want to change the target directory of the front window?

See: Reveal or Open Folder Without Opening a New Window

-Chris

I use column view.

As I have it working now, if there's a Finder window open, KM Open folder opens a new Finder window set to show the folder.
It would be slightly more convenient to have the target folder selected in the already open Finder window.

This version attempts to preserve the view of the current window when it changes the target.

-Chris


Change the Target Directory of the Front Finder Window and Maintain View 1.00.kmmacros (6.5 KB)

Thank you. I saw the original AppleScript. I'll try it out.
Time Passes...
Beautiful. I added a switch to Finder at the end.

1 Like

After adding an Activate Finder step and a little more fiddling I find this:

if a Finder window is open, the AppleScript works perfectly
if no Finder window is open, one doesn't open
Adding a ⌘N step in KM opens a new window even if one exists

It seems an else is needed after
"if exists of front window then"

I found this, but I'm out of my depth in AppleScript.

Okay, try this one.

Change the Target Directory of the Front Finder Window and Maintain View 1.01.kmmacros (7.9 KB)

1 Like