For some strange reason, text messages read from some BBS's come out doublespaced in the log. This is caused by repeated LF's (CHR$10).
I hacked up this little proggy to remove them.
INSTRUCTIONS FOR USE
There's only one option - Same Name. With it set (ticked in the menu) a file will be re-saved under the same name, otherwise it will be saved under a new name.
With Same Name set:
Dragging a text file to the !CutLF icon will cause it to be altered and resaved under the same name.
If the file is too large (say > 30K), an errorbox will appear and suggest saving under a new name, and the Same Name option will be automatically unset (cancelled).
With Same Name unset:
Dragging a text file to the !CutLF icon opens a 'Save As' box with a writeable filename. Dragging the SaveAs icon to a filer window will save it there under the new name.
TECHNICAL (not very)
Different sets of routines are used for SameName or (not Samename), however file reading in is identical.
The file is read line by line as strings using BGET. A blank (zero-length) line will not be written but sets a flag ( blank% ) so the next line (even if blank) still will. By this means legitimate blank lines in the text (e.g. between paragraphs) are preserved.
With Samename set, the text is written to RAM; when End of File is reached, the input file is closed, a file of same name opened, and the text read from RAM and written to it using BPUT.
With Samename unset, text is written direct to the output file using BPUT (without using any RAM).
As it happens, BPUT puts the right string endings (LF's) into the file; if OS_File 10 is used instead (when Samename is set) to write the RAM to a file, then CR's rather than LF's end up in the file.
!CutLF also quite coincidentally acts as a CR->LF convertor (it wasn't written that way, but it does that too!).
The 30K limit for Samename option is quite arbitrary, change it if you wish (in PROCoutfile) (subject to memory limitations of course).
If you want to play other games with the text, insert a call to e.g. PROCtwiddle in PROCProcessfile and PROCwritesamefile after the 'a$ = GET$#chanI%' line, and write your own PROCtwiddle to do the desired fiddling. Lose the IF.. THEN..ELSE stuff immediately after this line if you don't want to cut out doublespaced lines in the text.
DISCLAIMER
This was hacked up in a couple of hours, from a tagline-stealing program I wrote (!TagRip). The routine to find the file pathname for the filer window in the SaveAs routines took a lot of messing around with the PRM's and I'm not at all sure there isn't an easier way. If you know of one and want to write and tell me so, I'd be delighted.
You're welcome to use the code in this proggy in any way you like, including modifying the whole program to do your own thing with textfiles. Just make sure you change the Info window and this Help file (and the icon, preferably) so I don't get blamed for your programming crimes. I've got plenty of my own to answer for.
I DON'T claim this program is a textbook example to be followed, in fact it has a number of deficiencies. Use it if you want to.
Chris Rodliffe
56 Haycock Ave,
Lynfield North,
Auckland, N.Z.
GUARANTEE
The author guarantees that this program has apparently worked satisfactorily with no obvious crashes on an Acorn A5000 with RiscOS 3.1, 4MB RAM, twin 82MB Conner hard drives (swank!), 3 1/2" floppy drive, external 5 1/4" HD floppy, Hayes Ultra 96 Smartmodem, Logitech mouse, and Acorn mouse mat. Naturally nothing can be guaranteed for other setups (for example, should your mouse mat not be a genuine Acorn one).
The author will not be liable for loss of data, corruption of files, corruption of minors, war, strife, civil insurrection, volcanic eruption, global warming, continental drift, proton decay, premature baldness, American talkshows, Japanese cars, rap music, or any other sanity- or life-threatening phenomena.
ACKNOWLEDGEMENTS
Duncan Ferguson, for !ConvertLF, which used a number of Archimedes World routines including one which I pinched (PROCmsgBox).
RECOMMENDED VIDEO
'Pulse' by Pink Floyd. The lightshow is truly awesome.