DAMn Finder Part 3 (v10.0)

More on my Digital Asset Manager i(n) Finder macros.

The others have been trivial, maybe this one will be too. I have attached 2 macros that are intended to do the same thing. But fail essentially in the same way but in two different actions.

In the attached macros, the offending action is highlighted as red.

What am I attempting to do: Using the selection in the finder as a source image, I want to use it to change the icon of the parent folder.

Seems pretty straight forward. However, where I am attempting to assign the image from a variable, the action it fails. If on the other hand, I assign it by hard coding the path to the variable it works. The path format, I am pretty sure, is good. As it is the same variable that is used to derive the path of the parent folder. Which, again it works if I hard code the path in the action.

In one macro, I am attempting to do it directly from the image file to the Parent folder. In the other, I am attempting to side step it by assigning the image to the clipboard and then to the folder.

Too, if I put in %FinderSelection% in this location, it also fails. I would think this should work too, as the file is still selected at this point.

I suspect it is my naivety/stupidity here too.

A many gracious thanks!

Ñ

DAMn Finder Macros.kmmacros (8.3 KB)

Keyboard Maestro Export

Hi. I tested Set Parent Folder Image Direct with the debugger. I'm not a frequent user of Finder paths in Keyboard Maestro so was surprised to see that the path to the selected folder has a return character appended by (I think) KM. So when you get the Parent path it just strips the return character. Meaning you didn't get the Parent at all. Maybe I've hit a bug with Monterey, I don't know. But to get your code to work in my environment I would first have to assign the parent to Path (stripping the return character) and then assign the next parent to Parent. I haven't tested further... do you also see a return character at the end of Path when you run the debugger?

1 Like

Richard,

Thank you for the reply. I do in fact see the return character. however, when I display the variable to the window. (action that is turned off). I do not see it there. So, I assumed that was the actual output.

The "Parent" works as expected. It is the image file that is working wonky. (the one WITH the return character). I will see what it takes to manually strip the return character from the variable.

I too am working in Monterey.

Cheers!

¢£

Edit::: This does not work. I had an image already set into the Clipboard from which it pulled from. Bummer! So, how do I get rid of the carriage return?

:::::::::::::::::::
Richard,
That Carriage return was the issue. I fixed it by the action: Append Variable "Path" with Text "\b"
Using the escape character "\b" to do the work.

I wasn't sure KM would allow escape characters, but what do you know!
I did try to put the escape character directly into the original set Variable action, but that did not work

Thanks for the the nudge in the right direction!
I really love this app!!!

Ñ

Update: so, Keyboard Maestro does have escape Characters, but just not the "\b"

Bummer. Guess I will have to figure out how to execute a Python script. and do it there.

Ñ

This worked fine for me as long as I made sure the clipboard definitely contained an image:

The problem is setting the clipboard to the image of the selected file.

Do you mean an image file like a JPEG? If so, you can just copy it manually with C or with KM's Copy action.

Wouldn't that copy the file? Not the image within the file?

Yes, it copies the file, but for image files, it also places the image itself on the clipboard. Try it and see for yourself:

Set Parent Folder Image Direct.kmmacros (3.7 KB)

2 Likes

Low and behold! You are correct, it works! Thank you very much!

Though, I do not understand why it did not work the way I attempted. Nor do I understand why the \b token does not work as it actually is listed in the documentation.
https://www.keyboardmaestro.com/documentation/6/tokens.html

Both issues seem to be bugs.

Thank you again though!

Ñ

1 Like