Prompt from list of files does not work: path unknown

I am trying to use this macro posted by the late JMTX and later modified by @ccstone as an AppleScript

when I run the macro, I get a path unknown error.

List Important Files Test.kmmacros (12.5 KB)

initial macro was displayed here

thank you very much

Unescaped spaces in unquoted filepaths ?

See, e.g. How To Deal With Spaces in Paths on Mac and Linux

Hi @ronald.

I tried your macro with my own list of files thus:

KM 0 2022-08-10_12-39-39

and I did not get any errors at all. As you can see my file names contain spaces too, so I'm not at all sure what is going wrong with you.

The only reason you might therefore get a "path unknown" error that I can see is that there is no such file!

1 Like

Thank you for your post. I had entered dummy files.
I noticed that if the file paths are very long (multi line after I paste), the whole macro from display of search box to execution goes haywire which basically makes it useless
I am going bananas trying to troubleshoot this

Have you tried using $1s rather than \1s in your regex replacement?

I think OSX has a filename length limit

1 Like

thank you for your post
I have been using those file paths for many years, and they all work when used in an open file action.

@Nige_S @hello

It does not work. Just create an extra line with the character $ alone in the list displayed.

I ran a test with a short file path

/Users/ronald/Documents/Scrivener scriv files/Testing Test File.scriv__Test

When I run the macro I expect to see only one line with Test

I end up with 2 lines
first line the title test
second line the path

Only by clicking on Test can I open the file. If I click on the path in the list, the file is not opened.

Could this be a clue to the underlying problem?

thank you

Like @tiffle, the macro is working fine for me.

Have you got an actual failing path you can post as an example? This seems particular to your setup rather than a general KM issue, so we'll need to be as close to what you're doing as we can be.


I would guess that you are entering carriage returns when you should not be.

Post the whole macro as it was when it went wrong as you describe in the above quote. That way we will be able to see exactly what is going on, rather than having to rely on just your description.

I entered the following simple and short path without "__" title at the end to keep things simple

/Users/ronald/Downloads/noon menu plan.pdf

when I ran the macro, I see the following list. It should be only one line, but it's 2 lines: first line path, second line filename

thank you

@tiffle @Nige_S @Nige_S

My conclusion is that

  • yes there was an extra carriage return which explains why it is split into 2 lines. Sorry for the bungle.
  • the macro breaks down with long file names

thank you all for your help

Again -- post an example of a path which breaks it. We might be able to put our heads together an come up with a fix -- my first thought is that if all your files are in the same subsection of your directory tree you might be able to prune the "constant" prefix before displaying it, then add the prefix back in before opening it.

1 Like

I was playing around and now it works, so I will have to figure out what I did.

Filenames are all kinds of work stuff with complicated names. I prefer not to post for the moment, but it was an excellent suggestion

thanks again

I sometimes have to deal with similar, eg file paths with potentially confidential info. The trick is to copy the path, replace all the A-Za-z0-9 characters with the same number of a (or any other single character) but keeping any potentially "special" characters in there in case they are the problem.

Create that new path and file and test to see if the problem still exists -- if so you can happily send off that new path in your problem report and Support can test for path length, special characters, etc, without you divulging potentially sensitive information.

1 Like

/Users/ronald/Downloads/world domination.pdf

1 Like

/Users/nige_s/Pictures/Nasty rash on my.png :face_with_open_eyes_and_hand_over_mouth:


/Users/ronald/Downloads/New Spiderman movie script CONFIDENTIAL.pdf

/Users/ronald/Downloads/cold fusion.pdf


@Nige_S @hello

I am not suggesting my files are anything fancy. It's just that the filenames + paths are so long

They're obviously not too long for the OS, just for one (or more) parts of the macro. I'm suggesting that there may be ways to work round that, but without an example "bad" path to work with it'll be difficult to reproduce the problem.

1 Like