 CHANGE-A-FILE
 by
 Harold D. Portnoy
 
 ======================================================================
 
 Be sure to copy CHANGE-A-FILE before using!!!
 
 ---------------
 
      Because of the time spent in developing this program, I find it necessary
 to charge a small fee for the use of some of the utilities in CHANGE-A-FILE:
 Convert AWP to TXT, TXT to AWP, AWP 3.0 to 2.x; AWP File Doctor, Exhume AWP
 file, and Restore ADB file. These utilities are protected with a password that
 will also apply to future revisions. The remainder of the utilities remain
 free.
      The same password also unlocks the Auto-Restore function of the repair
 file program, RESURRECTION.
 
      To obtain the password, send $10.00 to:
 
        Change File
        c/o Harold D. Portnoy
        1431 Woodward
        Bloomfield Hills, MI 48302
 
 **********************************************************************
 
      When an AppleWorks word processor or data base file goes bad is not the
 time to worry about how you are going to repair the damage. AWP File Doctor and
 Restore ADB can repair these files. Each of these utilities, alone, are worth
 the small fee in time saved.
 
 **********************************************************************
 
 CHANGE-A-FILE                                               -                 -
 
 
      CHANGE-A-FILE is a batch file utility that reads AppleWorks Word Processor
 (AWP) and text (TXT) files; converts AWP files to TXT files, TXT files to AWP
 files, and AWP 3.0 files to AWP 2.x files; restores damaged AWP and ADB (data
 base) files; change file or auxiliary type codes, and strip line feeds. Up to
 88 files in a directory or subdirectory can be altered. This program uses the
 Bredon ProSel utilities type of format. CHANGE-A-FILE is particularly useful to
 the AppleWorks (AWKS) user and to prepare files for uploading or alter files
 after downloading.
 
 Password
      CHANGE-A-FILE is a system file. When run, the user is initially presented
 with a password screen. Entering the password allows the user to access all the
 program's utilities. If the password is not entered only the last 6 utilities
 listed below can be accessed. 
 
 Activating protected utilities and removing password screen
 
      Transfer the program file to the volume directory of a disk under ProDOS
 (P8). Rename the file to CF.SYSTEM. Be sure this file is the first .SYSTEM file
 in the directory (e.g. ahead of BASIC.SYSTEM). Boot the disk. (You must boot
 directly into CF.SYSTEM.) The password screen will be presented. Enter the
 password. When the menu is presented, select Quit. The file will be rewritten
 to the disk without the screen. Rename the file to CHANGE.FILE or any other
 name of your choice. Whether you have the passwo
 rd or not, the password screen will be removed. If you enter the password, all
 the utilities will be able to be used. If not, only the 'free' utilities will
 be able to be used. 
      If RESURRECTION is placed in the same directory as CF.SYSTEM, the Auto-
 Restore function will be unlocked on entering the password and then quitting.
 
  Menu
      The program menu is as follows:
          ________________________________________________
 
              Q- Quit
              X- Convert AWP 3.0 to 2.x 
              W-     ... AWP File to TXT File
              T-     ... TXT File to AWP File
              D- AWP File Doctor
              E- Exhume AWP File
              R- Restore ADB File
              V- View File (TXT, AWP, etc.)
              F- Change File Type/Aux. Type/Access Code             L- Strip
 Line Feed after Carriage Return
              C-   ... All Control Characters
              S-   ... Specified Control Character
              I- Insert Line Feed after Carriage Return
          ________________________________________________
 
      The appropriate utility can be selected from the main menu with the light
 bar selector, by entering the appropriate letter or by using the mouse.
 Pressing RETURN, a letter or the mouse button accepts the selection.
 
  Directory Selection
      The volume directory name is the initial default directory. The default
 source directory or destination directory can be accepted by pressing RETURN or
 mouse button. Any directory online can be entered. These directories will
 remain the default directories until changed or the program is quit. The TAB
 key tabs to the next slash in a directory pathname and then to the end of the
 pathname. Control-X switches the source and destination directories.
 Alternately, the prefix can be selected by pressing the Closed Apple (Option)
 key. A list of directories is presented from which one can be selected in a
 manner similar to that in AppleWorks (AWKS) 3.0. The up and down arrows or the
 mouse move the light bar selector, RETURN or the mouse button selects a
 subdirectory and Open Apple-RETURN accepts the completed directory name. If an
 error is made, pressing TAB lets you restart the selection.
 
 File Selection
      Files are selected or deselected with the spacebar or mouse button. A
 check mark is placed in front of the selected file. The light bar can be
 positioned using the four arrow keys or mouse. When using the spacebar or mouse
 
 button to select a file, the selection is made in the direction first
 initiated. After selecting the desired files, press RETURN. ESCape always
 returns you to the main menu.
 
 The Utilities
 
 Convert AWP 3.0 to 2.x file.         Usually AWP files generated by Appleworks
 3.0 cannot be read by versions 2.1 and below. If you do not have version 3.0,
 an AWP 3.0 file can be read by your version of Appleworks by converting the AWP
 3.0 to an AWP 2.x file. The suffix ".X" is added to the file name. If the
 original name is greater than 13 characters, the last two characters are
 replaced with the suffix. This utility is particularly useful for those AWKS3.0
 users who would like to upload AWP files that can be read by all versions of
 AWKS.
      The AWP 3.0 file is not converted if it is already compatible with the AWP
 2.x format and the source and destination directories are the same. This is
 indicated by a bell and a diamond replacing the check mark.
 
 Convert AWP to TXT file.
      This utility converts AWP files into text files. In preparation for
 uploading, each line is followed by a carriage return. If you want a carriage
 return only at the end of a paragraph, press the Open Apple key at the start of
 the conversion. Pressing the Open Apple key also sets the left margin to zero.
      The text file created is designated by the suffix ".W" added to the
 original file name. The original file is preserved. The auxiliary file code is
 changed to $0000.
 
 Convert TXT to AWP file.
      This utility converts TXT files into AWP files. The conversion,
 particularly of multiple files, is considerably faster than using the
 AppleWorks from text file option. Only sequential text files are accepted
 (auxiliary file code = $0000). The new file is designated by the suffix ".T"
 added to the original name. The original file is left undisturbed. When loaded
 into AppleWorks, the file may not properly word wrap. This is easily corrected
 by changing any margin justification. 
 
 AWP File Doctor.
      When an AWP file is damaged, it cannot be loaded into AppleWorks instead
 the 'Getting error trying to read ...' message is displayed. The AWP File
 Doctor will almost always restore the non-corrupted portions of an AWP file to
 a new file that can be loaded into AWKS. The restored file has the suffix ".D"
 added to the file name. Asterisks replace the bad bytes, however, if the bad
 bytes are text characters, these characters may be displayed. The characters
 usually make no sense and are easily identified. Except for the damaged text,
 the new file requires no revision.
      If the file is loaded into AWKS 2.x and the 'Getting error .." message is
 still displayed, first convert the file to AWP 2.x format using Convert AWP 3.0
 to 2.x, reload the file and try again.
 
 Exhume AWP.
     If the file is so damaged that AWP File Doctor cannot repair it, then
 Exhume AWP should be tried. Exhume AWP restores the AWP file by searching for
 text characters. The restored file contains all characters in the text
 character range. Thus text characters that are not part of the original text
 
 will be included (frequently an additional character at the beginning and end
 of a text line). Non-text characters are replaced with an asterisk. If the
 number of characters exceeds 79 only one line of asterisks is added. The
 repaired file has the suffix ".E" added to the file name.
      The exhumed file when loaded into AWKS must be edited to remove spurious
 characters and add any text that may have been corrupted. This is the hard part
 of the repair, but usually not as hard as having to rewrite the whole file from
 scratch.
      It is suggested that a damaged AWP file be processed by both the AWP File
 Doctor and Exhume AWP. The former will reconstruct almost all of the file in a
 form requiring virtually no revision. The latter may extract a few more words
 of value.
 
 Restore ADB
      If an AppleWorks Data Base (ADB) file is corrupted, the file can be
 restored with Restore ADB. Damage can occur within a category, to individual
 records or to the header. Damage limited to within a category is flagged with
 an asterisk. If one or more categories have been damaged, the entire record (or
 contiguous records) cannot be restored and the first category in the record(s)
 is flagged with the message '** DAMAGED RECORD(S) **'. When this message occurs
 as the first record, a report record may actually have been damaged.
      If the file header is damaged, a standard header is substituted, which
 contains 30 categories. Category names may or may not be restored depending on
 whether the names were damaged. Report formats will be lost and have to be
 reentered. Occasionally, if the file still cannot be loaded into AWKS after
 processing with Restore ADB, the file may still be restored by forcing the
 standard header. This can be done by pressing the Closed Apple key when the ADB
 file is selected.
 
 ______________________________________________________________________
 
      NOTE: AWP File Doctor, Exhume AWP and Restore ADB will restore files with
 bad blocks. The message '** BAD BLOCK **' is inserted when a bad block is
 encountered. These utilities cannot repair a file if the volume directory or
 subdirectory are damaged (and sometimes the file directory pointing to the data
 blocks in the file). If one of the directories is damaged, I suggest using the
 ProSel utility, Mr. Fixit or my new utility, RESURRECTION.
      If you have a file that cannot be restored and the various directories are
 intact, please send it to me so that I can improve the algorithms used in the
 AWKS and ADB repair utilities. Copy the disk on which the file exists using a
 nibble copying utility such as Copy II+ and send the copy, not the original.
      Occasionally, when several blocks have been damaged, AWP File Doctor will
 produce a new file that cannot be loaded into AWKs. Try using AWP File Doctor
 again on the new file. This will usually restore the file. If not, use Exhume
 AWP.
 ______________________________________________________________________
 
 
 View file.
      This utility will read any file. It works best with text files. Control
 characters are presented in uppercase inverse. The spacebar stop/starts the
 file.
      If the file is an AppleWorks word processor (AWP) file (AW 3.0 and lower
 versions), it will automatically read it properly. (Read AWP is no longer a
 
 separate utility.) This allows you to rapidly review TXT or AWP files in order
 to determine if you wish to use or convert them. The spacebar allows you to
 step through the file. Restart scrolling with the down arrow key. The RETURN
 key can be used to abort the file. The left margin is automatically set. For
 convenience, the file may be output to a printer. Reading AWP files works best
 when the characters per inch is 10. If word wrap appears defeated, try pressing
 Open Apple at the beginning of the conversion (see AWP to TXT above).
       The printer output is set to slot 1. If you use a different slot, then
 change the low nibble of byte $05 (C1) to the slot number. This is most easily
 accomplished using a block editing utility such as ProSel Block Warden.
 Alternately the following patch will suffice after setting the prefix to the
 directory containing CHANGE.
 FILE.
 
              POKE 768,19n  (where n = slot number + 2)
              BSAVE CHANGE.FILE,TSYS,A$300,L1,B5
 
 Change file type, auxiliary type or access codes.
      Any file type can be altered. You are responsible for the alteration. No
 checking is done. Following selection of the file(s), the previous file type is
 presented at the cursor and can be accepted as the default by pressing RETURN.
 Alteration can be accomplished using the designated file type abbreviations
 displayed (e.g. BIN, TXT). Or, if the abbreviation is not listed, by entering
 the hexadecimal code (e.g. $04, $06). If you have a favorite abbreviation that
 is not listed then the list can be altered
 .
      Using a block editor, such as ProSel Block Warden, the abbreviation list
 can be altered to suit yourself. The file type table begins at byte $07 with A0
 A0 A0 20. There is another similar four byte combination that can be changed to
 a three byte ASCII abbreviation, which replaces the three A0's, followed by the
 file type code, which replaces the 20. Alternately, one of the other
 abbreviations can be changed along with its following file code byte. (Note: To
 my knowledge, there is no assigned abbreviation to code 20.)
      After the file type code is accepted, the auxiliary type code is presented
 and can be altered by entering the appropriate code at the cursor. When the
 auxiliary type code is governed by the file type code (e.g. SYS always loads at
 $2000), the appropriate default can be accepted by pressing RETURN or the mouse
 button.
      The file access code can then be altered. The file can be toggled locked
 or unlocked, or each of the recognized bits in the byte can be separately
 toggled. The bits are 7 (Destroy-enable), 6 (ReName-enable), 5 (BacKUp-needed),
 2 (INVisibility, GS/OS only), 1 (WRiTe enable), 0 (ReaD-enable). If the bit is
 set (1), then the bit is enabled. If cleared (0), then the bit is disabled. If
 bits DES,RN and WRT (7,6,1) are all set, then the file is considered unlocked.
 If any of these bits are cleared then the file is considered locked. The right
 and left arrows and the mouse move the cursor. The spacebar toggles whether the
 file is locked or not as well as the individual bits. The RETURN key or the
 mouse button accepts the displayed values.
      NOTE: The changes in this section are not written to the file until the
 final RETURN. ESCape always sends you back to the main menu.
 
 Line feed stripper.
      This utility strips line feeds that follow a carriage return. Only text
 files are accepted. The original file is preserved.
 
      Two other control character strippers are available. One removes all
 control characters, and the other will remove any specified control character
 (^J = line feed). If the specified control character is 'M' (e.i. carriage
 return), then a space is substituted for the carriage return. All the control
 character strippers designate the altered file with the ".C" suffix.
 
 Insert line feed after carriage return.
      Some users apparently wish to communicate with Big Blue machines. This
 utility inserts a line feed after each carriage return in a text file, which is
 required by IBM and IBM compatible computers.
      And for those of you wishing to read from the UNIX system, press the Open-
 Apple key before entering 'I'. This will convert line feeds to carriage
 returns.
 
 
      When converting files or stripping a control character with only one disk
 drive, the source and destination volumes must be the same.
 
 
 Icons
      CF.RES.ICONS contains Change-A-File and Resurrection icons. The Change-A-
 File icon is courtesy of Karl Bunker. To use these icons in the Finder, place
 CF.RES.ICONS in the ICONS subdirectory of the boot volume
 (BOOT.VOLUME/ICONS/CF.RES.ICONS) and reboot.  The two programs must have file
 names of CHANGE.FILE and RESURRECTION.
 
 
      Suggestions, bugs and other trivia to:
 
         Compuserve [75156,2436]
         GEnie [H.PORTNOY]
 
 
 All rights reserved.
 
 AppleWorks, copyright Claris Corporation
 ProSel, copyright Glen Bredon
 Copy II+, copyright Central Point Software, Inc.
 
 
 Version updates:
         1.95- Add output to printer for Read AWP.
         2.0 - Add Convert TXT to AWP
         2.05- Minor bug
         2.1 - Add ability to Change Access Code. Cosmetic
               alteration to Change File Type.
         2.15- Clear backup bit now works correctly.
         2.20- Fix bug in alter auxiliary type code.
         2.30- Add mouse to menu and file selector.
         2.35- Add mouse to pathname selection.
         2.37- A smoother mouse.
         2.40- Corrects input bug.
         2.41- Add mouse to file type, auxiliary type, and aux
               code.
 
         2.46- Corrects bug when used with IIe and single
               drive. Adds clock.
         2.48- Corrects bug in quit when used with IIe.
         2.61- Update to AW 3.0 format in read AWP and AWP to
               TXT.
         2.63- Eradication of small AWP to TXT infestation.
         2.64- Eases AW version conversion.
         2.66- Adds AWP 3.0 to 2.x converter.
         2.68- Adds View File (by request of several users).
         2.69- A few cosmetic changes.
         2.71- Corrects bug that prevented proper launching directly
               from P8 and certain selectors.
         2.73- Update of AWP 3.0 format and a few cosmetic changes.
         2.75- Adds directory name selector.
         2.76- Bug correction in AWP 3.0 to 2.x.
         2.77- Bug correction, View file, IIc only.
         2.78- Corrects bug in TXT to AWP and AWP 3.0 to 2.x. AWP
               header byte +004 must be $4F (ruler length) otherwise 
               the new file cannot be saved properly when using 
               AWKS 3.0 (does not effect AWKS 2.x).         2.81- Adds Exhume
 AWP which extracts all text characters 
               from a damaged AWP file. For highly damaged files and
               requires considerable editing. Also corrects a few bugs.
         2.85- Adds AWP File Doctor. Corrects several minor bugs and
               adds some cosmetic changes.
         2.87- Adds Restore ADB, a utility for restoring ADB files.
               Read AWP is now included under View File.
         2.88- Corrects bug in Restore ADB.
         2.89- Now able to restore AWP and ADB files with bad blocks.
         2.90- Some improvements and a dead bug.
         2.91- Additional header information preserved in Restore ADB.
         2.92- Fixes bug in password. Updated documentation.
         2.93- Improved bad block routine.
         2.94- Bug fix and now, if specified control character is ^M
               (e.i. carriage return), a space is substituted.
         2.95- Password scheme changed so as to activate RESURRECTION
               Auto-Restore function.
         2.96- Remove bug from RESURRECTION activation scheme.
         2.97- Add insert line feed after carriage return. Bug fix
               in strip line feed after carriage return.
         2.98- Password scheme change made necessary by RESURRECTION
               change.
         2.99- Add convert line feed to carriage return.
         3.00- Correct minor bug in directory input.
         3.01- Correct bug in filetype listing when over 66 files
