Append text to file not working

I'm trying to add some text to the end of a text file. When I use the "append text to file", KM sort of does it, but the file gets all messed up.
It adds \ to the end of every entry.
Then it adds an ugly header:

{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600

{\fonttbl\f0\fswiss\fcharset0 Helvetica;}

{\colortbl;\red255\green255\blue255;}

{*\expandedcolortbl;;}

\margl1440\margr1440\vieww10800\viewh8400\viewkind0

\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0

\f0\fs42 \cf0

The text file is .rtf. Is that the problem?

Text files mean files that aren't RTF files. RTF files are complex beasts, like maybe an MS Word or WordPerfect file. You can't just add text, as far as I know. But nothing is impossible. You may have to use different actions instead of the action you are currently using. For example you may be able to load the RTF file into the clipboard, then there may be a way to add text to the clipboard, then save it with the Write ClipBoard to File Using RTF action.

That's all I have to say at the moment. Feel free to ask for clarifications.

You can't just append text to an RTF file.

You might be able to do this sequence:

  • Read the File in to a Named Clipboard.
  • Search and Replace Clipboard the Named Clipboard, using regex, to replace ā€œ\zā€ with your replacement text. The replacement text will have to be appropriately encoded if it includes any slosh () or percent (%) characters.
  • Write to a File.

The Read file action, will read the styled text.

The Search & Replace action should honour the existing format of the text.

And the write file can then write the named clipboard back to the rtf.

Ok, thank you. i see now. I suspected rtf was the problem. I learned a very handy short cut in textedit: shift+command+t. Solved so many problems i was having.