home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128CPM / PIPMAG-5.ARC / ASCII-TO.WS next >
Encoding:
Text File  |  2019-04-13  |  5.5 KB  |  115 lines

  1.                            ASCII to WS - The Easy Way
  2.  
  3.                                        by
  4.  
  5.                              Brad Harris (BHARRIS)
  6.  
  7.               Copyright 1990 by Brad Harris - All Rights Reserved
  8.  
  9.           There are a number of programs around that claim to reformat 
  10.      straight ASCII text for Wordstar. They all work, with varying degrees 
  11.      of success. However, there's an easier way to do the same thing 
  12.      without running a separate program, using Wordstar's Search and 
  13.      Replace function.
  14.  
  15.           Straight ASCII text has a hard carriage return (CR), consisting 
  16.      of both a carriage return (^M) and a line feed (^J), at the end of 
  17.      every line. A Wordstar document uses a CR only at paragraph ends and 
  18.      between lines.
  19.  
  20.           So how do we use Search and Replace to remove these from the 
  21.      ASCII text? If you try to enter ^M as Search text, Wordstar treats it 
  22.      as if you had hit ENTER on a blank line, and ^J brings up the Help 
  23.      screen. Well, there is a command that will enter both at once for us, 
  24.      in a way that Wordstar understands. This is ^N, the Line Insert 
  25.      command.
  26.  
  27.           Before we start, here are some rules and suggestions to make life 
  28.      a little easier.
  29.  
  30.           Always make a backup copy of the file you're going to be working 
  31.      on! If it's on your work disk (dummy) give it an entirely new name. 
  32.      Don't just call it FILENAME.BAK or Wordstar will overwrite it. Not 
  33.      having a backup is the best way to insure that you will screw up, the 
  34.      power will fail, or your cat will do the Texas Two-Step on the 
  35.      keyboard. Always make a backup copy of the file you're going to be 
  36.      working on!
  37.  
  38.           Use ^KS to save your work after each step. That way, when you 
  39.      make a mistake and send your file to California (where things get 
  40.      strange), you only loose a few minutes of work.
  41.  
  42.           There must be at least one blank line between paragraphs. If 
  43.      paragraphs in your text aren't separated by blank lines, you'll need 
  44.      to go through it and insert them. Otherwise you'll end up with one L - 
  45.      O - N - G paragraph.
  46.  
  47.           Each Search and Replace operation has to be started at the top of 
  48.      the file. (Use ^QR)
  49.  
  50.           To speed things up, set the Search and Replace options to Global 
  51.      (whole file), Don't Ask.
  52.  
  53.           If the text contains things like graphs, charts, or tables that 
  54.      won't stand reformatting, they should be ^KW - Block Copied to 
  55.      separate files, then ^KR - File Inserted back in later. If there's 
  56.      only one, you can accomplish the same thing by doing the Search and 
  57.      Replace from just above the block Backwards, then do it again from 
  58.      below the block on the Rest of File. (In the opinion of yr-hmbl-srvnt, 
  59.      that's to much trouble to write, let alone do.)
  60.  
  61.           Margins for blocks like those just mentioned should be set up 
  62.      before reformatting begins.
  63.  
  64.           So we begin. First, count the maximum number of blank lines 
  65.      between any two blocks of text, and add one to this number. For 
  66.      example; if there are three blank lines between headings and following 
  67.      paragraphs, the number is four. This is to account for the CR at the 
  68.      end of the last line before the blanks.
  69.  
  70.           Move to the top of the file. Hit ^QA - Search and Replace. For 
  71.      the Search term, hit ^N four times. Each time, you'll actually see 
  72.      ^M^J. The Replace term should be a character that doesn't appear 
  73.      anywhere in the text. Just enter this once, and write it down 
  74.      somewhere (not in your text). Call it 4, for the number of CRs it's 
  75.      holding.
  76.  
  77.           Repeat the process, this time Searching for three ^M^J 
  78.      combinations. (If you use the Delete key to edit your first Search 
  79.      term, you'll notice that you have to hit it twice, once for the ^M, 
  80.      and again for the ^J. They are, in fact two separate characters, but 
  81.      can only be entered in combination.) Use a different, unique, 
  82.      character for the place holding Replace term. Write this one down too, 
  83.      calling it 3.
  84.  
  85.           Repeat the process, this time for two CRs. Again use a different 
  86.      place holder, and write it down.
  87.  
  88.           Do it once more, for one CR. This time, replace it with - 
  89.      nothing.
  90.  
  91.           At this point our text is one long paragraph, sprinkled through 
  92.      with odd characters where paragraphs used to end and blank lines used 
  93.      to be. Can you read it aloud in one breath? Can you say hypoxia? Don't 
  94.      worry (be happy), we'll have it fixed in a minute.
  95.  
  96.           Reassembly is the reverse of disassembly, and is left as an 
  97.      exercise for the reader. Ha Ha, Just kidding!
  98.  
  99.           But really, it is the reverse. We're going to Search and Replace 
  100.      all our strange little place holders, Replacing them with CRs.
  101.  
  102.           Search for the first place holder, the one we called 4. For the 
  103.      Replace term, hit ^N four times to insert four CRs. Repeat, using 
  104.      place holder 3, and inserting three CRs; and again using 2 and two 
  105.      CRs.
  106.  
  107.           Now go back to the top of your file and do a Global Reformat 
  108.      (^QU).
  109.  
  110.           That's all there is to it. You may have to go through and center 
  111.      titles and headers to dress things up a bit.  And you might have to do 
  112.      a Search and Replace, changing double spaces to single spaces (several 
  113.      times), but you can be sure that your text is the way Wordstar likes 
  114.      it, because Wordstar did it.
  115.