Desktop File Translator
by Mark Moxon

The Desktop File Translator enables certain codes in text files to be expanded into alternative characters or strings. A good use for this would be for converting text files for use with DTP packages. The version on this disc converts DeskEdit files into Impression text files, keeping the style information intact. For example, the DeskEdit code for 'Italics On' is 130, and this is translated into the string:
{font Trinity.Medium.Italic}
which tells Impression to switch to the default italic font. The application can be tailored for your own purposes, as described below.

Using the Translator
--------------------
Running the application installs an icon on the icon bar, with a menu containing two items: a greyed-out Save entry, and a Quit entry (which terminates the application). Dragging a text file to the icon bar will load that text file and a beep will be heard; the Save option will no longer be greyed out, and now leads to a standard save box. The text file can be saved using the standard methods, and if it is dragged into an application which supports RAM transfer, then the file will be saved using that method (i.e. scrap files on disc are not used).

The saved text file will be similar to the text file dragged to the icon, except that certain special characters will have been replaced by certain characters or strings. If you look at the end of the listing, there is a set of DATA statements. Each DATA statement contains a number and a string, signifying that each occurrence of the character with that ASCII code will be transformed into that string. In the program given here, the statements are set up for DeskEdit to Impression translation. The DATA statements can be edited freely to create any kind of byte-to-string replacement you want: the only proviso is that the very first DATA statement contains the number of pairs given. For example, you could tailor the application to convert single byte codes into printer escape sequences.

One point to note with this application is that there are two buffers set up to hold the original text file and the transformed text file. The sizes of these buffers are set up in lines 100 and 110. If larger files are to be used, these values should be changed.

 RISC User 1993
