home *** CD-ROM | disk | FTP | other *** search
- ASCII to WS - The Easy Way
-
- by
-
- Brad Harris (BHARRIS)
-
- Copyright 1990 by Brad Harris - All Rights Reserved
-
- There are a number of programs around that claim to reformat
- straight ASCII text for Wordstar. They all work, with varying degrees
- of success. However, there's an easier way to do the same thing
- without running a separate program, using Wordstar's Search and
- Replace function.
-
- Straight ASCII text has a hard carriage return (CR), consisting
- of both a carriage return (^M) and a line feed (^J), at the end of
- every line. A Wordstar document uses a CR only at paragraph ends and
- between lines.
-
- So how do we use Search and Replace to remove these from the
- ASCII text? If you try to enter ^M as Search text, Wordstar treats it
- as if you had hit ENTER on a blank line, and ^J brings up the Help
- screen. Well, there is a command that will enter both at once for us,
- in a way that Wordstar understands. This is ^N, the Line Insert
- command.
-
- Before we start, here are some rules and suggestions to make life
- a little easier.
-
- Always make a backup copy of the file you're going to be working
- on! If it's on your work disk (dummy) give it an entirely new name.
- Don't just call it FILENAME.BAK or Wordstar will overwrite it. Not
- having a backup is the best way to insure that you will screw up, the
- power will fail, or your cat will do the Texas Two-Step on the
- keyboard. Always make a backup copy of the file you're going to be
- working on!
-
- Use ^KS to save your work after each step. That way, when you
- make a mistake and send your file to California (where things get
- strange), you only loose a few minutes of work.
-
- There must be at least one blank line between paragraphs. If
- paragraphs in your text aren't separated by blank lines, you'll need
- to go through it and insert them. Otherwise you'll end up with one L -
- O - N - G paragraph.
-
- Each Search and Replace operation has to be started at the top of
- the file. (Use ^QR)
-
- To speed things up, set the Search and Replace options to Global
- (whole file), Don't Ask.
-
- If the text contains things like graphs, charts, or tables that
- won't stand reformatting, they should be ^KW - Block Copied to
- separate files, then ^KR - File Inserted back in later. If there's
- only one, you can accomplish the same thing by doing the Search and
- Replace from just above the block Backwards, then do it again from
- below the block on the Rest of File. (In the opinion of yr-hmbl-srvnt,
- that's to much trouble to write, let alone do.)
-
- Margins for blocks like those just mentioned should be set up
- before reformatting begins.
-
- So we begin. First, count the maximum number of blank lines
- between any two blocks of text, and add one to this number. For
- example; if there are three blank lines between headings and following
- paragraphs, the number is four. This is to account for the CR at the
- end of the last line before the blanks.
-
- Move to the top of the file. Hit ^QA - Search and Replace. For
- the Search term, hit ^N four times. Each time, you'll actually see
- ^M^J. The Replace term should be a character that doesn't appear
- anywhere in the text. Just enter this once, and write it down
- somewhere (not in your text). Call it 4, for the number of CRs it's
- holding.
-
- Repeat the process, this time Searching for three ^M^J
- combinations. (If you use the Delete key to edit your first Search
- term, you'll notice that you have to hit it twice, once for the ^M,
- and again for the ^J. They are, in fact two separate characters, but
- can only be entered in combination.) Use a different, unique,
- character for the place holding Replace term. Write this one down too,
- calling it 3.
-
- Repeat the process, this time for two CRs. Again use a different
- place holder, and write it down.
-
- Do it once more, for one CR. This time, replace it with -
- nothing.
-
- At this point our text is one long paragraph, sprinkled through
- with odd characters where paragraphs used to end and blank lines used
- to be. Can you read it aloud in one breath? Can you say hypoxia? Don't
- worry (be happy), we'll have it fixed in a minute.
-
- Reassembly is the reverse of disassembly, and is left as an
- exercise for the reader. Ha Ha, Just kidding!
-
- But really, it is the reverse. We're going to Search and Replace
- all our strange little place holders, Replacing them with CRs.
-
- Search for the first place holder, the one we called 4. For the
- Replace term, hit ^N four times to insert four CRs. Repeat, using
- place holder 3, and inserting three CRs; and again using 2 and two
- CRs.
-
- Now go back to the top of your file and do a Global Reformat
- (^QU).
-
- That's all there is to it. You may have to go through and center
- titles and headers to dress things up a bit. And you might have to do
- a Search and Replace, changing double spaces to single spaces (several
- times), but you can be sure that your text is the way Wordstar likes
- it, because Wordstar did it.
-