Action Failure by "Get Comment to Variable"

I get an "Action Failed" message, when i try to get comments from a file. I tried it with different file types (files and folders, with comments and without comments).

And it's ok in the same situation for exemple with the action get file name

Presumably the File variable does not have the correct path to the file.

Getting the file name simply gets the last path component of the specified path, so you can feed it

/fred/bill/harry

And it will return harry whether there is any such directory or not.

But getting the comment (or other file attributes) requires the file to actually exist and hence the path to actually be correct.

Thank you for your answer!

I understand but I've the same problem here with in both case the same file is selected.

You can see up right the error message. fore the option get comment.

And here all is ok with the option get the name

and this one failed too

Most likely the folder where the file is in (or one of the intermediate folders) is excluded from Spotlight.

Open System Preferences > Spotlight, click the Privacy tab and make sure that none of the parent folders is listed there. (In your last example this could be “v” or “Desktop”.)

1 Like

Thank your for your message.

I’ve no files excluded from Spotlight.

Is Spotlight enabled on the volume?

What do you get when you run this in the Terminal?:

mdutil -s /Volumes/"Mac HD"

Replace Mac HD with the actual name of the volume where the file is on (with the quotes).
If it is the current start volume you can also run mdutil -s /

Please post the output here.

2 Likes

output:

Error: unexpected indexing state. kMDConfigSearchLevelTransitioning
MacBook-Pro-de-Vvv:~ v$

OK, something seems to be wrong.

Assuming that your start volume is still the same as when you made your KM experiments before, try this:

sudo mdutil -i on /

Don’t forget to enter the space and the slash after the “on”. Then hit Return.
You will be asked for the admin password. Enter it and hit Return again.

This will (try to) enable Spotlight for the start volume. So do this only if you want to enable Spotlight.

It will take some seconds until you see an output. If the output is Indexing enabled then try your macro again (maybe wait a couple of minutes). Otherwise please post the output here.

3 Likes

It’s working now!

Thank you very much!

Nice debugging effort @Tom!

Thank you Tom. It solved the same issue i had here.

Note to PeterNLewis, You call the file attribute "comment"
while Apple calls it "Comments" in the Get Info window, although Applescript call it also "comment".