@redfox
Quote:
However, when I try to copy from the clipboard to a text file,
the text has a filetype header imbedded in the first line.
FORM2FTXTCHRS&
Again ... rather than reinvent the wheel, I decided to just use NotePad instead. I can prefill text into the textfile, edit with NotePad if I need to make changes, save the file and move on. It is easy to launch NotePad using an ARexx script.
address command 'SYS:Utilities/NotePad "filename"'
Update...
Used ARexx delete string command to delete those extra characters in the clipboard file. There must have been some nonprintable characters, because I could see 14 but had to delete 20.
Everything in the AmigaOS clipboard is based on the ElectronicArts IFF format, extended by Commodore, and later adopted by Apple ("AIFF") and MicroSoft ("RIFF", wrong endian version of IFF) as well.
It's always
IFF, no matter if text, audio, graphics, video or something else.
Even the most simple content: Text.
"FORM" (IFF identifier) + 32 bit length of the complete data + "FTXT" (formatted text IFF sub-id) + 32 bit length of the "FTXT" part + "CHRS" (identifier for the actual data) = 4 ("FROM") + 4 (size) + 4 ("FTXT") + 4 (sub size) + 4 ("CHRS") = 20 bytes minimum header.
There are other, optional, IFF chunks/sub-headers for FTXT like "FONS" (the font to be used), and at least since AmigaOS 4.x one for the charset (ISO-8859-15, UTF-8, etc.) of the "CHRS" content, check for example
https://wiki.amigaos.net/wiki/FTXT_IFF_Formatted_TextIn any case you should use the IFF parsing rules, instead of simply removing the first 20 bytes. There are IFF libraries with ARexx interface for parsing, reading and writing IFF data, both for clipboard and files.