Get URL, save to clipboard, then append to RTFD formatted file fails

Howdy folks, I'm scratching my head here trying to figure out why I'm not able to append an image file to a rich text document. Below is a screenshot as well as the macro itself in question (note that the first action is to run an Internet speed test using speedtest-cli, which is disabled as not everybody has it installed, and it's not the source of the problem).

Basically the shell script uses json to parse the results, from which I use RegEx to grab the "Share" URL (which is a PNG image file), saving it to a local variable. I then use the get URL action to save that image (stored in the local variable) to the system clipboard.

The follow action is where it fails...the write system clipboard to file. Below is the error message Keyboard Maestro gives me.

2021-09-17 12:22:47 Write File action failed to read source text
2021-09-17 12:22:47 Write File action failed to read source text In macro “Trying” (while executing Write System Clipboard to File).

I'm not sure why it's not able to write the file to the RTFD file, as I have verified that the system clipboard does indeed contain the image itself. I have tried different methods, such as appending to file, but when I select append, the only format option is plain text which obviously won't work.

So is this simply the wrong action? Or is it not possible to write an image to a rich text file? Or is there some other issue I'm overlooking here? Thanks in advance for any help!

EDIT: One more thing I just remembered, even though I can open TextEdit, and paste in the image from the system clipboard, and save it as a RTFD document, whenever Keyboard Maestro tries to write the clipboard to the same file, it gives me that error, and moves the file to the trash! SUPER strange...

Internet Speed Test (speedtest-cli) (for testing) (for export).kmmacros (3.2 KB)

Hey Chris,

Well, for one thing a .rtfd file is not a file – it's a package. I.E. a folder that looks like a file.

Try creating one with TextEdit, right-clicking it in the Finder, and looking inside.

-Chris

:man_facepalming:t3: I guess that’s what I get for assuming RTFD stood for rich text formatted document :sweat_smile:

1 Like

RTF is Rich Text Format.

RTFD is Rich Text Format Directory.

I don’t use either very often. I tend to use plain text in markdown and convert it to something else at the end.

1 Like

Thanks for the awesome information.