I'm at a loss. "Open File" constantly fails as "non-existent" path. I cannot figure out where I went wrong

Hi There!

I have a macro that looks at a selected folder, appends it's path to a file, sends that path to a prompt list and then SHOULD open it when selected. While it worked for a short minute, it randomly no longer does. Anyone have any ideas?

I figured it must be something wrong with my syntax of the file-path, but copying the path directly out of the written file and into the "Open" command in a separate macro works perfectly. It only fails when it's used as a variable. What am I doing wrong?? I'm pulling my hair out.

EDIT: Here are the actual macros:

List.kmmacros (5.7 KB)
Save FavPath1.kmmacros (4.4 KB)

Here's some screenshots.

The save filepath macro: (there are three of them, FavPath1, 2, & 3)

The prompt list/open folder macro:

The resulting list:

And of course, the resulting error:

It’s always a good idea to upload your macro instead of just posting screenshots. Without an actual macro to test, we are very limited in how much we can help. For simple macros, looking at screenshots might be enough, but if it’s not, we have no way to diagnose it without completely rebuilding your macro. :wink:

So that being said, it appears that your variable ListResult that you use to open the file is likely prepended with Fav 1, Fav 2 or Fav 3, resulting in an incorrect path. You can either open the Value Inspector (⌘6 by default) or look in the variable pane in the KM preferences to see the actual value of that variable.

You’ll need to either 1) not prepend the paths with that info, or 2) remove that bit from the ListResult variable. If you want to remove it from the variable, you can do it using the action below.

Remove Favorite prependage from path.kmactions (689 Bytes)

Action Screenshot (click to expand/collapse)

-Chris

@cdthomer Thanks so much for your reply. Good to note about uploading, I just edited the original post with my macros!!!

You are a genius, I don't know why I didn't see it. Removing the "Fav's" totally worked. That being said, for searching purposes (I plan to have more favs in the list once I get this thing working) I would love to keep those prefixes within the list if possible.

I tried your search and replace expression and it doesn't seem to work in this case. Any further thoughts?

1 Like

Ah darn, I left out the trailing space after the Regex pattern. I’m not at my computer and can’t provide another action, but just replace the Regex pattern in my previous action with this:

^Fav \d+\s

That will remove the trailing space between Fav… and the start of the path itself so it should work at that point. If it doesn’t, let me know and when I’m back at my computer I’ll download your macro to look into it further.

@cdthomer Sorry for the delay but that worked perfectly! Thanks so much for your help.

1 Like