; $VER: Digita Wordworth 3.1 Lite  23/9/94 (deutsch)
; Installer Revision 2 - 2/9/94
; ©Copyright 1994 Digita International

(complete 0)

(set #ProductName "Wordworth 3.1")
(set #ProductVersion "Special Edition Deutsch")

; ### VARIABLES
;** The amount of space needed on the hard disk to install
        (set FullHDSpace 3)
        (set FullHDLibsSpace 100000)
        (set Language "Deutsch")              ; variable for catalog language

;** Various
        (set FloppyFinished 0)


; ### INSTALL DISK NAMES
(set NumberInstallDisks 3)
(set #Install1Disk "Ww3.1SEInstall-1")
(set #Install2Disk "Ww3.1SEInstall-2")
(set #Install3Disk "Ww3.1SEInstall-3")

;** Archive Names and size of files on DISK 1
(set #WordworthSourceName
        (cat #Install1Disk ":Archive/Wordworth.lzh"))
(set #WwFiles1SourceName
        (cat #Install1Disk ":Archive/WwFiles1.lzh"))
(set #WwFiles3SourceName
        (cat #Install1Disk ":Archive/WwFiles3.lzh"))
(set #CatalogsSourceName
        (cat #Install1Disk ":Archive/Catalogs.lzh"))

(set #BootDiskFiles
        (cat #Install1Disk ":Archive/Boot"))
(set #SystemFontsSourceName
        (cat #Install1Disk ":Archive/Fonts.lzh"))
;(set #PrefsSourceName
;       (cat #Install1Disk ":Archive/Prefs.lzh"))
(set #AmigaGuideSourceName
        (cat #Install1Disk ":Archive/AmigaGuide.lzh"))
(set #ASLSourceName
        (cat #Install1Disk ":Archive/asl.lzh"))
(set #DiskFontSourceName
        (cat #Install1Disk ":Archive/diskfont.lzh"))

(set #FontType1SourceName
        (cat #Install1Disk ":Archive/IFOnly.lzh"))

(set #ModuleOption1SourceName
        (cat #Install1Disk ":Archive/Draw.lzh"))
(set #ModuleOption2SourceName
        (cat #Install1Disk ":Archive/Picture.lzh"))
(set #ModuleOption3SourceName
        (cat #Install1Disk ":Archive/TextFX.lzh"))


;** Archive Names and size of files on DISK 2
(set #WwProgSourceName
        (cat #Install2Disk ":Archive/WwProg.lzh"))
(set #WwFiles2SourceName
        (cat #Install2Disk ":Archive/WwFiles2.lzh"))

(set #IntelliSourceName
        (cat #Install2Disk ":Archive/Intelli.lzh"))
(set #UFSTSourceName
        (cat #Install2Disk ":Archive/UFST.lzh"))
(set #FloppyOtagsSourceName
        (cat #Install2Disk ":Archive/OTAGS.lzh"))

(set #CustomExtras1SourceName
        (cat #Install2Disk ":Archive/Tutorials.lzh"))
(set #CustomExtras2SourceName
        (cat #Install2Disk ":Archive/Templates.lzh"))
(set #CustomExtras3SourceName
        (cat #Install2Disk ":Archive/Clipart.lzh"))

(set #WwToolsSourceName
        (cat #Install2Disk ":Archive/WwTools.lzh"))
(set #WwHelpSourceName
        (cat #Install2Disk ":Archive/WwHelp.lzh"))

(set #FiltersSourceName
        (cat #Install2Disk ":Archive/Filters.lzh"))
(set #GfxFilter1SourceName
        (cat #Install2Disk ":Archive/CGM.lzh"))


;** Archive Names and size of files on DISK 3
(set #DictionarySourceName
        (cat #Install3Disk ":Archive/Dictionary.lzh"))
(set #ThesaurusSourceName
        (cat #Install3Disk ":Archive/Thesaurus.lzh"))


;** Archive names
(set #WordworthName "Wordworth.lzh")
(set #WwProgName "WwProg.lzh")
(set #WwFiles1Name "WwFiles1.lzh")
(set #WwFiles2Name "WwFiles2.lzh")
(set #WwFiles3Name "WwFiles3.lzh")
(set #AmigaGuideName "amigaguide.lzh")
(set #SystemFontsName "Fonts.lzh")
(set #ASLName "asl.lzh")
(set #DiskFontName "diskfont.lzh")
;(set #PrefsName "Prefs.lzh")
(set #CatalogsName "Catalogs.lzh")
(set #WwHelpName "WwHelp.lzh")

(set #ModuleOption1Name "Draw.lzh")
(set #ModuleOption2Name "Picture.lzh")
(set #ModuleOption3Name "TextFX.lzh")

(set #IntelliName "Intelli.lzh")
(set #TrueTypeName "TrueType.lzh")
(set #WwToolsName "WwTools.lzh")
(set #UFSTName "UFST.lzh")
(set #FloppyOtagsName "OTAGS.lzh")
(set #FontType1Name "IFOnly.lzh")

(set #IFlibraryName "DigitaIntellifont.library")

(set #FiltersName "Filters.lzh")
(set #FiltersFileName "wwfilter.library")
(set #AmigaGuideLibraryName "amigaguide.library")

(set #GfxFilter1Name "CGM.lzh")

(set #CustomExtras1Name "Tutorials.lzh")
(set #CustomExtras2Name "Templates.lzh")
(set #CustomExtras3Name "Clipart.lzh")

(set #DictionaryName "Dictionary.lzh")
(set #ThesaurusName "Thesaurus.lzh")

(set #Module1Name "Drawing Tools")       ;These are the filenames of the expanded modules
(set #Module2Name "Picture")
(set #Module3Name "TextEffects")


;** Disk Names
(set #RamTempFile "RAM:WwTemp")
(set #LibsDefault "Libs")
(set #SystemFontsDest "Fonts")

(set #Font1Name "WW_STANDARD_Pica")
(set #Font2Name "Condensed60.font")
(set #Font3Name "newtopaz.font")
(set #NumFonts 3)

(set #Parallel "Parallel")
(set NumNewWwDisks 4)
(set #NewWwDiskName     "Wordworth3")
(set #NewWwSysDiskName "Ww3System")
(set #NewWwOutlinesDiskName "Ww3Outlines")
(set #NewWwDictDiskName "Ww3Spell")

;** Envarc drawer and variable names
(set #WwDrawerName "Wordworth")
(set #WwFontsEnvName "WwFonts")

;** HD Drawer Names
(set #DrawerName "Wordworth3")
(set #Wordworth2DrawerName "Wordworth2")
(set #WordworthSEDrawerName "Wordworth")

(set #ModulesName "Modules")
(set #ModDisName "Storage")
(set #WwCatalogsName "Catalogs")
(set #WwFilesDrawerName "WwFiles")
(set #WwFiltersName "Filters")
(set #WwPictureFiltersName "Pictures")
(set #WwFontsName "WwFonts")
(set #WwAgfaName "Intellifont")
(set #WwPSName "PostScript")
(set #WwTTName "TrueType")
(set #WwUFSTName "UFST")
(set #WwHDHelpName "Help")
(set #DocsName "Documents")
(set #TemplatesName "Templates")
(set #ClipartName "ClipArt")
(set #SpellName "Spell")
(set #WwToolsDrawerName "WwTools")
(set #BulletOutlinesDest "Fonts:_bullet_outlines")
(set #LocaleName "Locale")

(set #WwDevsDest (cat #NewWwDiskName ":Devs"))
(set #WwPrefsDest (cat #NewWwDiskName ":Prefs"))
(set #WwEnvArcDest (cat #NewWwDiskName ":Prefs/Env-Archive"))
(set #WwEnvArcSysDest (cat #NewWwDiskName ":Prefs/Env-Archive/sys"))
(set #WwSDest (cat #NewWwDiskName ":s"))

(set #WwToolDest (cat #NewWwDiskname ":Wordworth"))
(set #DocsTool "DOCS")
(set #ClipartTool "CLIPART")
(set #DeviceTool "DEVICE")
(set #FiltersTool "FILTERS")
(set #ModulesTool "MODULES")
(set #HelpTool "HELP")
(set #CatalogsTool "CATALOGS")
(set #WwFilesTool "WWFILES")
(set #WwSpellLibTool "WWSPELLLIB")
(set #WwSystemTool "WWSYSTEM")
(set #DocDefaultTool "Wordworth")

(set #OldUserDictName "User_Dictionary")
(set #OldAutoCorrectName "AutoCorrect.txt")
(set #TempUserDictName "User_Dictionary.Temp")
(set #TempAutoCorrectName "AutoCorrect.txt.Temp")


; ### STRING DEFINITIONS
;** Various Strings
(set #ProgName (cat (cat #ProductName " ") #ProductVersion))

(set #Welcome-Help
(cat "\nIf you have any problems with installing, please use the "
        "\"Help\" buttons on the installer and read the appropriate sections "
        "of the manual.\nIf your problems persist, you can get Technical "
        "Support as explained in your 'Wordworth Instruction Book'."
))

(set #BadKick
(cat #ProgName " requires Workbench 2.04 or above to work correctly."
))

(set #BadASL
(cat #ProgName " requires version 38 of the ASL.Library or above to work correctly."
))

(set #BadDiskFont
(cat #ProgName " requires version 37 of the diskfont.Library or above to work correctly."
))

(set #BadASLandDiskFont
(cat #ProgName " requires version 38 of the ASL.Library and version 37 of the "
        "diskfont.Library or above to work correctly."
))

(set #ReBoot
(cat "Vor dem Start Reseten ! Beim Start Regist-Nr. 2438791 angeben !"
))

(set #FloppyWorkingMsg
(cat "\n\n\nPlease wait...\n\n" #ProgName " is being installed to your floppy disks."
))

(set #HardDiskWorkingMsg
(cat "\n\n\nPlease wait...\n\n" #ProgName " is being installed to your hard disk."
))

(set #FormatWorkingMsg
(cat "Please wait... Formatting a disk."
))

(set #FloppyFinishedMsg
(cat "\nAfter clicking the 'Proceed' button, place the \"" #NewWwDiskName
        "\" disk in the internal disk drive and reset your Amiga.\n"
))

(set #CheckStartup
(cat "\n\n\nPlease wait...\n\nThe installer is just checking your system."
))

(set #DearchivingMsg
(cat "\n\n\nPlease wait..."
))


;** Disk Messages
(set #FloppyBackupsMsg
(cat "\nIMPORTANT\n\nThe installer will now create your " #ProgName 
        " disks.\n\nTo keep disk changes to a minimum, if you "
        "have more than one disk drive, place the newly created disks "
        "('" #NewWwDiskName "' for example) into the internal disk "
        "drive when prompted, and place the Wordworth install disks "
        "(`" #Install1Disk "' for example) into the external disk drive."
))

(set #BlankDiskWarning
(cat "\nPlease insert a 'blank' disk in the internal\n"
        "disk drive and click \"Proceed\" when ready."
        "\n\nWARNING: This procedure will destroy all information "
        "that may already be on the disk."
))

(set #FloppyWarningHelp
(cat    "\nThis procedure uses the 'format' command to "
        "wipe and prepare the disk in the internal disk drive "
        "for use with Wordworth."
        "\n\nWrite-protect your master disks before making "
        "backup copies and place the masters in a safe place."
        "\n\nYou should also write-protect your backup disks "
        "before clicking the \"Proceed\" button."
))

(set #NotBlankMsg1
(cat "\nYou have the \""
))

(set #NotBlankMsg2
(cat "\" disk in your internal disk drive.\n\nPlease "
        "replace this disk with a blank one, before "
        "clicking the \"Proceed\" button."
))

(set #FormatError
(cat    "\nAn error occured when trying to format this disk.\n\n"
        "Please ensure that the disk is in the disk drive "
        "before you click the \"Proceed\" button or "
        "put another disk in the drive and try again."
))

(set #FormatErrorHelp
(cat "\nAn error has occured during the formatting of "
        "your disk. This could be for many reasons, but more "
        "commonly, either the disk was corrupt or the drive was "
        "faulty.\nPlease try a different disk, check the drive "
        "and then if the problem persists, contact the Technical "
        "Support Department. Information on how to get Support is "
        "explained in the manual."
))

(set #FormatCompleteMsg1
(cat " created.\n\nPlease take out the disk "
        "in the internal disk drive and label it \""
))

(set #FormatCompleteMsg2
(cat "\", then click the \"Proceed\""
        " button."
))

(set #FormatCompleteMsgLast
(cat "\". Click the \"Proceed\" button to continue."
))

(set #InsertDiskMsg
(cat "\nPlease insert the disk labelled\n\n"
))

;** Install Stuff
(set #DestChoicePrompt
(cat "\n\n\nWhere would you like to install " #ProgName "?"
))

(set #DestChoicePrinterPrompt
(cat "\n\n\nWhere have you installed " #ProgName "?"
))

(set #FloppyChoiceMsg
(cat "On floppy disks"
))

(set #HardDiskChoiceMsg
(cat "On a hard disk"
))

(set #DestChoiceHelp
(cat "\nSelect the radio button \"On a hard disk\" to "
        "install " #ProgName " onto your hard disk.\n\n"
        "Select the radio button \"On floppy disks\" to "
        "install " #ProgName " onto a set of backup disks.\n\n\n"
))

(set #DestChoicePrinterHelp
(cat "\nSelect the radio button \"On a hard disk\" if "
        "you installed " #ProgName " onto your hard disk.\n\n"
        "Select the radio button \"On floppy disks\" if you "
        "installed " #ProgName " onto a set of blank disks.\n\n\n"
))


;** Other strings
(set #Unpackmsg1 "Unarchiving ")
(set #Unpackmsg2 " to ")
(set #Unpackmsg3 "\n\nPlease wait...")
(set #Unpackmsg4 "Please wait...\n\nUnarchiving files.")

(set #DearchiveModulesmsg "Dearchiving and Installing Modules")
(set #DearchiveFontmsg "Dearchiving and Installing Font Support\n\n")
(set #DearchiveGfxmsg "Dearchiving and Installing GFX Filters")
(set #DearchivingSpellmsg "Installing Spell Checker")
(set #DearchiveThesmsg "Installing Thesaurus")
(set #InstallMinmsg "Installing Minimum Configuration")
(set #InstallOthermsg "Installing All Modules")
(set #DeleteOldmsg "Please wait...\n\nRemoving old Wordworth.")
(set #Creatingmsg "Creating Disk ")

(set #WorkingPrintermsg "Please wait...\n\nInstalling Printer.")
(set #FormatChoiceprompt
        (cat "\nWordworth needs to format and name " NumNewWwDisks " disks during installation. "
                "For more information click 'Help'. Do you wish to:"
))
(set #FormatChoicemsg1 "Slow Format Some Blank Disks")
(set #FormatChoicemsg2 "Quick Format Some Blank Disks")
(set #FormatChoice-Help
        (cat "This installation utility needs to prepare " NumNewWwDisks" disks before installing "
                #ProgName ". Before each disk is created, it will be formatted and named. "
                "\n\nChoose '" #FormatChoicemsg1 "' if you wish to perform a full format, or \nchoose "
                "'" #FormatChoicemsg2 "' to perform a quick format on disks that must have been "
                "previously formatted as Fast File System disks."
))
(set #Installingmsg1 (cat "Please wait...\n\nInstalling " #ProgName))


(set #InstallBOPrompt 
(cat "\nDo you wish to install your Workbench compugraphic fonts "
                 "for use with " #ProgName " ?"
))
(set #InstallBOChoice1 "Yes")
(set #InstallBOChoice2 "No")
(set #InstallBOPrompt-Help 
(cat "\nYou may have compugraphic fonts in the 'bullet_outlines' drawer "
                 "in your Workbench partition.\n\nIf you choose '" #InstallBOChoice1
                 "' then " #ProgName " will allow you to use any fonts you have in this drawer."
                 "\nChoose '" #InstallBOChoice2 "' if you do not want to install these fonts."
))

(set #BadBoot
(cat "You must turn on your machine with the \"" #Install1Disk
     "\" disk in the internal drive before installing or running "
     #ProgName "."
))

(set #Wwdiskhelp
        (cat "\nIf you know that the correct disk is in the drive, but you "
                "still cannot proceed, then the name of the disk is incorrect.\n"
                "The name of this disk should be \""#NewWwDiskName "\" with no "
                "blank spaces before, after or within the name.\n\n"
                "To rename the disk correctly, select the disk icon (the graphic "
                "that appears on the Workbench screen when the disk is inserted), choose "
                "the Rename command from the Workbench Icons menu, delete the contents "
                "of the text gadget and type \"" #NewWwDiskName "\"."
        )
)

(set #diskhelp
        (cat "\nIf you know that the correct disk is in the drive, but you still cannot proceed, "
                "then the name of the disk is incorrect.\n"
                "Ensure that the disk name is not preceded by 'copy_of_', or blank spaces before or after the disk name.\n\n\n" @askdisk-help
        )
)

(set #HardDiskDestChoiceMsg
(cat "Where do you want to install the\n" #ProgName " drawer?"
))

(set #InstallASLChoice1 "Yes - Replace it")
(set #InstallASLChoice2 "No")

(set #InstallAGChoice1 "Yes - Replace it")
(set #InstallAGChoice2 "No")

(set #InstallDiskFontChoice1 "Yes - Replace it")
(set #InstallDiskFontChoice2 "No")

(set #OldASLLibraryMsg
(cat "You may have an old version of the ASL.library.\n\n"
        #ProgName " requires you have at least version 38 of this "
        "library. Do you want to replace your ASL.library with version 38 ?"
))

(set #OldASLLibraryHelp
(cat #ProgName " will not work properly unless you have at least version 38 "
        "of the ASL.library (Workbench 2.1 or above).\n\n"
        "Choose \"" #InstallASLChoice1 "\" to replace your version with version 38 "
        "and then install " #ProgName ".\nChoose \"" #InstallASLChoice2 "\" to not install "
        "version 38 and to quit this installation utility."
))

(set #OldAmigaGuideLibraryMsg
(cat "You may have an old version of the amigaguide.library.\n\n"
        #ProgName " requires you have at least version 34.11 of this "
        "library.\nDo you want to replace your amigaguide.library with version 34.11 ?"
))

(set #OldAmigaGuideLibraryHelp
(cat #ProgName " will not work properly unless you have at least version 34.11 "
        "of the amigaguide.library (Workbench 2.1 or above).\n\n"
        "Choose \"" #InstallASLChoice1 "\" to replace your version with version 34.11 "
        "and then install " #ProgName ".\nChoose \"" #InstallASLChoice2 "\" to not install "
        "version 34.11 and to quit this installation utility."
))

(set #OldDiskFontLibraryMsg
(cat "You may have an old version of the DiskFont.library.\n\n"
        #ProgName " requires you have at least version 37 of this "
        "library. Do you want to replace your DiskFont.library with version 37 ?"
))

(set #OldDiskFontLibraryHelp
(cat #ProgName " will not work properly unless you have at least version 37 "
        "of the DiskFont.library (Workbench 2.1 or above).\n\n"
        "Choose \"" #InstallDiskFontChoice1 "\" to replace your version with version 37 "
        "and then install " #ProgName ".\nChoose \"" #InstallDiskFontChoice2 "\" to not install "
        "version 37 and to quit this installation utility."
))

(set #HDLibsDestChoiceMsg1
(cat "Where do you want to install the Digita font libraries ?"
))

(set #HDLibsDestChoiceMsg2
(cat "Where have you installed the Digita font libraries ?"
))

(set #HardDiskDestChoiceHelp
(cat "Select the drawer where you want to install " #ProgName
        ", then click Proceed (a new drawer titled \"" #DrawerName
        "\" will be created and will contain the " #ProgName " program.)"
))

(set #HDLibsDestChoiceHelp
(cat "Select the drawer where you want to install "
        "the Digita font libraries"
        ", then click Proceed (the default is 'Libs:').\n"
        " If the destination is not 'Libs:' then the chosen "
        "destination must be added to the 'Libs:' path."
))

(set #HardDiskDestChoiceConfirmMsg1
(cat "\nAre you sure you want to install " #ProgName " in the "
        "destination:\n\n\""
))

(set #HardDiskDestChoiceConfirmMsg2
(cat "\"\n\n\n\n(A new drawer titled \"" #DrawerName "\" will be "
        "created and this will contain the " #ProgName " program.)"
))

(set #HardDiskDestChoiceConfirmHelp
(cat "Click YES to keep the destination drawer.\n\nClick NO "
        "if you want to change the destination drawer."
))

(set #DrawerExistsMsg
(cat "\nA drawer titled \"" #DrawerName "\" already exists in "
        "the destination you have chosen.\n\nDo you wish to replace it "
        "or choose a new destination?\n\n"
))

(set #DrawerExistsChoice1 "Replace it")
(set #DrawerExistsChoice2 "Choose new destination")

(set #DrawerExistsHelp
(cat "\nYou have chosen a destination drawer which already has \""
        #DrawerName "\" installed there.\n\nClick \""
        #DrawerExistsChoice1 "\" to replace the contents with this new version "
        "of " #ProgName ".\nClick \"" #DrawerExistsChoice2 "\" to choose a "
        "new destination drawer.\n\n"
        "If you choose \"" #DrawerExistsChoice1 "\" then please make sure you "
        "have back up copies of any documents you wish to keep."
))

(set #NoDiskSpaceMsg1
(cat "\nThere is insufficient available space on your hard disk to install "
        #ProgName ". You will need a minimum of "
))
(set #NoDiskSpaceMsg2
(cat "MB of free disk space.\n\nEither click \"Abort Install\" to exit this "
        "installation and delete some files from your hard disk, or click \"Proceed\" and try a "
        "different partition."
))

(set #NoLibSpaceMsg1
(cat "\nThere is insufficient available space in '"
))
(set #NoLibSpaceMsg2
(cat "' to install the " #ProgName " libraries. You have "
))
(set #NoLibSpaceMsg3a
(cat "K free but will need a minimum of "
))
(set #NoLibSpaceMsg3b
(cat "K of free disk space.\n\nEither click \"Abort Install\" to exit this "
        "installation and delete some files from your hard disk, or click \"Proceed\" to try a "
        "different partition."
))

(set #LibAbortMsg1
(cat "There is insufficient space in your System partition on your hard disk to install the "
        #ProgName " libraries. You have "
))
(set #LibAbortMsg2
(cat "K free but need a minimum of "
))
(set #LibAbortMsg3
(cat "K of free disk space. "
        "Please make space free by deleting some files and try to "
        "install again or contact Digita technical support."
))

(set #ArchiveAbortMsg1
(cat "There was a problem when trying to dearchive `"
))
(set #ArchiveAbortMsg2
(cat "', please try installing again. If you have a hard disk, try a "
        "different drawer or partition.\nIf problems persist consult the "
        "Help file and Instruction Book before contacting Digita Technical "
        "Support."
))

(set #AskEnvArc
(cat "\nIn which disk or drawer should the environment settings "
        "(ENVARC:) be saved?"
))
(set #AskEnvArcHelp
(cat "\nThis section lets you choose in which drawer, or on which disk, "
        #ProgName " places its enviroment settings.\n\nThese should normally go "
        "in the \"ENVARC:\" directory of your system disk or partition.\n\n"
        @askdir-help
))

(set #AskEnvArcStartup
(cat "\nYour system startup sequence did not contain an assign for "
        "ENVARC:. Do you wish to add this assign to \"S:User-Startup\"?"
))
(set #AskEnvArcStartupHelp
(cat "\nSelect YES to add assign to the user-startup file\n\n" @startup-help
))

(set #AskEnvStartup
(cat "\nYour system startup sequence did not contain an assign for "
        "ENV:. Do you wish to add this assign to \"S:User-Startup\"?"
))
(set #AskEnvStartupHelp
(cat "\nSelect YES to add assign to the user-startup file\n\n" @startup-help
))

(set #DriverUsedmsg1
(cat "\n\nThe standard Workbench printer driver for the printer you chose, `"
))
(set #DriverUsedmsg2
(cat "', has been installed."
))

(set #InstallingFontsmsg "Please Wait...\n\nInstalling Fonts.")

(set #InstallOldWordworthFontsmsg
(cat "\nFor information on how to use your existing Agfa fonts with "
        #ProgName ", please refer to the 'How To' section "
        "of the " #ProgName " help."
))

(set #InstallationCompletemsg "\nPrinter Installation Complete!\n")


; ### PROCEDURE DEFINITIONS

;** Set up Destinations
(Procedure @SetUpDestinationsHD
        (
    (set #InsideHDDest (tackon #DestDrawer #DrawerName))
    (set #HDModulesDest (tackon #InsideHDDest #ModulesName))
    (set #HDModDisDest (tackon #HDModulesDest #ModDisName))
    (set #HDCatalogsLangDest (tackon #InsideHDDest #WwCatalogsName))
    (set #HDCatalogsDest (tackon #HDCatalogsLangDest Language))
    (set #HDWwFiles1Dest (tackon #InsideHDDest #WwFilesDrawerName))
    (set #HDWwFiles2Dest (tackon #InsideHDDest #WwFilesDrawerName))
    (set #HDWwFiles3Dest (tackon #InsideHDDest #WwFilesDrawerName))
    (set #HDWwFiltersDest (tackon #InsideHDDest #WwFiltersName))
    (set #HDWwPictureFiltersDest (tackon #HDWwFiltersDest #WwPictureFiltersName))
    (set #HDWwFontsDest (tackon #InsideHDDest #WwFontsName))
    (set #HDWwAgfaDest (tackon #HDWwFontsDest #WwAgfaName))
    (set #HDWwPSDest (tackon #HDWwFontsDest #WwPSName))
    (set #HDWwTTDest (tackon #HDWwFontsDest #WwTTName))
                (set #HDWwUFSTDest (tackon #HDWwFontsDest #WwUFSTName))
    (set #HDWwHelpDest (tackon #InsideHDDest #WwHDHelpName))
    (set #HDDocsDest (tackon #InsideHDDest #DocsName))
    (set #HDTemplatesDest (tackon #HDDocsDest #TemplatesName))
    (set #HDClipartDest (tackon #InsideHDDest #ClipartName))
    (set #HDDictDest (tackon #InsideHDDest #SpellName))
    (set #HDThesDest (tackon #InsideHDDest #SpellName))
    (set #HDWwToolsDest (tackon #InsideHDDest #WwToolsDrawerName))
  )
)


;** define all hard disk destinations
(Procedure @SetHardDiskDestinations
        (
                (set #ModulesDest #HDModulesDest)
                (set #ModDisDest #HDModDisDest)
                (set #CatalogsLangDest #HDCatalogsLangDest)
    (set #CatalogsDest #HDCatalogsDest)
    (set #WwFiles1Dest #HDWwFiles1Dest)
    (set #WwFiles2Dest #HDWwFiles1Dest)
    (set #WwFiles3Dest #HDWwFiles1Dest)
    (set #WwFiltersDest #HDWwFiltersDest)
    (set #WwPictureFiltersDest #HDWwPictureFiltersDest)
    (set #WwFontsDest #HDWwFontsDest)
    (set #WwAgfaDest #HDWwAgfaDest)
    (set #WwPSDest #HDWwPSDest)
    (set #WwTTDest #HDWwTTDest)
    (set #WwUFSTDest #HDWwUFSTDest)
    (set #WwHelpDest #HDWwHelpDest)
    (set #DocsDest #HDDocsDest)
    (set #TemplatesDest #HDTemplatesDest)
    (set #ClipartDest #HDClipartDest)
    (set #DictDest #HDDictDest)
    (set #ThesDest #HDThesDest)
    (set #WwToolsDest #HDWwToolsDest)
        )
)

;** define all floppy disk destinations
(Procedure @SetFloppyDiskDestinations
        (
                (set #LocaleDest (cat #NewWwDiskName ":" #LocaleName))
                (set #ModulesDest (cat #NewWwDiskName ":" #ModulesName))
                (set #ModDisDest (cat #NewWwDiskName ":" #ModulesName "/" #ModDisName))
                (set #CatalogsLangDest (cat #NewWwDiskName ":" #WwCatalogsName))
    (set #CatalogsDest (cat #NewWwDiskName ":" #WwCatalogsName "/" Language))
    (set #LibsDest (cat #NewWwDiskName ":" #LibsDefault))
    (set #SysFontsDest (cat #NewWwDiskName ":" #SystemFontsDest))
    (set #WwFilesDest (cat #NewWwDiskName ":" #WwFilesDrawerName))
    (set #WwFiles2Dest (cat #NewWwSysDiskName ":" #WwFilesDrawerName))
    (set #WwFilterLibDest (cat #NewWwOutlinesDiskName ":" #WwFilesDrawerName))
    (set #WwFiltersDest (cat #NewWwOutlinesDiskName ":" #WwFiltersName))
    (set #WwPictureFiltersDest (cat #NewWwOutlinesDiskName ":" #WwFiltersName "/" #WwPictureFiltersName))
    (set #WwFontsDest (cat #NewWwOutlinesDiskName ":" #WwFontsName))
    (set #WwFontsDestOutlines (cat #NewWwOutlinesDiskName ":" #WwFontsName))
    (set #WwAgfaDest (cat #NewWwOutlinesDiskName ":" #WwFontsName "/" #WwAgfaName))
    (set #WwPSDest (cat #NewWwOutlinesDiskName ":" #WwFontsName "/" #WwPSName))
    (set #WwTTDest (cat #NewWwOutlinesDiskName ":" #WwFontsName "/" #WwTTName))
    (set #WwUFSTDest (cat #NewWwOutlinesDiskName ":" #WwFontsName "/" #WwUFSTName))
    (set #DocsDest (cat #NewWwOutlinesDiskName ":" #DocsName))
    (set #TemplatesDest (cat #DocsDest "/" #TemplatesName))
    (set #ClipartDest (cat #NewWwSysDiskName ":" #ClipartName))

    (set #DictDest (cat #NewWwDictDiskname ":" #SpellName))
    (set #ThesDest (cat #NewWwDictDiskname ":" #SpellName))

    (set #WwToolsDest (cat #NewWwSysDiskName ":" #WwToolsDrawerName))
    (set #WwHelpDest (cat #NewWwOutlinesDiskname ":" #WwHDHelpName))
        )
)


;** Procedure to copy 'Unpackfile' archive to RAM:Archives
(procedure @CopyArchives
        (
                (copyfiles
                        (source UnpackFileDisk)
                        (dest "RAM:Archives")
                        (all)
                )
        )
)


;** Procedure to decompress file set in 'UnpackFile' to 'UnpackDest'
(procedure @UnpackFiles
        (
        (working #Unpackmsg1 UnpackFile #Unpackmsg2 UnpackDest #Unpackmsg3)
                (set ExpandName UnpackFile)
                (set #ArchiveError 0)
                (set RunLHA
                        (cat "LHA -m e \"" ExpandName "\" \"" UnpackDest "\"")
                )
                (set #ArchiveError (run RunLHA))
                (if (> #ArchiveError 0)
                        (
                                (set #ArchiveAbortMsg (cat #ArchiveAbortMsg1 ExpandName #ArchiveAbortMsg2))
                                (abort #ArchiveAbortMsg)
                        )
                )
        )
)


;** Procedure to Check if Wordworth already exists in destination
;** Replace or choose again if so
(procedure @CheckExistsAlready
        (
    (if (exists (tackon #DestDrawer #DrawerName)) ; if there is already a drawer named Wordworth3
      (
        (set ChooseAgainAnswer
          (askbool
            (prompt #DrawerExistsMsg)
            (choices #DrawerExistsChoice1 #DrawerExistsChoice2)
            (help #DrawerExistsHelp)
            (default 1)
          )
        )
        (if (= ChooseAgainAnswer 0)
          (
            (set WwNotExists 0)
          )
          (;else
            (@PreserveTextFiles)
            (@DeleteOldWordworth3)
            (set WwNotExists 1)
          )
        )
      )
      (;else
        (set WwNotExists 1)
      )
    );endif
        )
)

;** Procedure to choose the hard disk destination
(procedure @FindHDDest
        (
                (set WwNotExists 0)
    (while (= WwNotExists 0)
                        (
        (@ChooseHDDest)
        (while (< (getdiskspace #DestDrawer) HDSpaceNeededBytes)
                (
                (if (< (getdiskspace #DestDrawer) HDSpaceNeededBytes)
                (
                                                    (if (= @user-level 0)
                                                      (
                                                        (user 2)
                                                        (set #UserNovice 1)
                                                      )
                                                    )
                (message #NoDiskSpaceMsg1 (/ (/ HDSpaceNeededBytes 1024) 1024) #NoDiskSpaceMsg2)
                (@ChooseHDDest)
                )
                        )
                )
                ) ;end while
                (@CheckExistsAlready)
            )
          );end while
    (if (= #UserNovice 1)
      (user 0)
    )
        )
)

(procedure @ChooseHDDest
        (
                ;** Find default drawer
                (set #DefaultDest (getassign "Work" "d"))
                (if (= #DefaultDest "")
                        (
                                (set #DefaultDest (getassign "HD3" "d"))
                                (if (= #DefaultDest "")
                                        (
                                                (set #DefaultDest (getassign "HD2" "d"))
                                                (if (= #DefaultDest "")
                (
                (set #DefaultDest (getassign "HD1" "d"))
                (if (= #DefaultDest "")
                  (
                    (set #DefaultDest (getassign "DH1" "d"))
                    (if (= #DefaultDest "")
                      (
                        (set #DefaultDest (getassign "HD0" "d"))
                        (if (= #DefaultDest "")
                          (
                            (set #DefaultDest "DH0:")
                            (if (= #UserNovice 1)
                              (user 2)
                            )
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        )
                        )
                )
                ;** Ask for destination
                (set #DestDrawer
                        (askdir
                                (prompt #HardDiskDestChoiceMsg)
                                (help #HardDiskDestChoiceHelp)
                                (default #DefaultDest)
                        )
                )
    (if (= #UserNovice 1)
      (user 0)
    )
        )
)


;** Create all Ww drawers in #DestDrawer and set paths to them
(procedure @CreateDrawers
        (
                (set #InsideHDDest (tackon #DestDrawer #DrawerName))
                ;** Make the Wordworth drawer
                (makedir #InsideHDDest (infos))

                ;** Make the Modules drawer
                (set #HDModulesDest (tackon #InsideHDDest #ModulesName))
                (makedir #HDModulesDest (infos))
                        ;** Make the Modules Disabled drawer
                        (set #HDModDisDest (tackon #HDModulesDest #ModDisName))
                        (makedir #HDModDisDest (infos))

                ;** Make the Catalogs drawer
                (set #HDCatalogsLangDest (tackon #InsideHDDest #WwCatalogsName))
                (makedir #HDCatalogsLangDest)
            ;** Make the language drawer
            (set #HDCatalogsDest (tackon #HDCatalogsLangDest Language))
                        (makedir #HDCatalogsDest)

                ;** Make the WwFiles drawer (just do once for #WwFilesDrawerName)
                (set #HDWwFiles1Dest (tackon #InsideHDDest #WwFilesDrawerName))
                (makedir #HDWwFiles1Dest)

    ;** Make the Filters drawer
    (set #HDWwFiltersDest (tackon #InsideHDDest #WwFiltersName))
    (makedir #HDWwFiltersDest)
        ;** Make Picture Filters drawer
        (set #HDWwPictureFiltersDest (tackon #HDWwFiltersDest #WwPictureFiltersName))
        (makedir #HDWwPictureFiltersDest)

                ;** Make the WwFonts drawer
                (set #HDWwFontsDest (tackon #InsideHDDest #WwFontsName))
                (makedir #HDWwFontsDest (infos))
                        ;** Make the Agfa drawer
                        (set #HDWwAgfaDest (tackon #HDWwFontsDest #WwAgfaName))
                        (makedir #HDWwAgfaDest (infos))
                        ;** Make the PS drawer
                        (set #HDWwPSDest (tackon #HDWwFontsDest #WwPSName))
                        (makedir #HDWwPSDest)
                        ;** Make the TT drawer
                        (set #HDWwTTDest (tackon #HDWwFontsDest #WwTTName))
                        (makedir #HDWwTTDest)
                        ;** Make the UFST drawer
                        (set #HDWwUFSTDest (tackon #HDWwFontsDest #WwUFSTName))
                        (makedir #HDWwUFSTDest)

                ;** Make the WwHelp drawer
                (set #HDWwHelpDest (tackon #InsideHDDest #WwHDHelpName))
                (makedir #HDWwHelpDest)

                ;** Make the Docs drawer
                (set #HDDocsDest (tackon #InsideHDDest #DocsName))
                (makedir #HDDocsDest (infos))
                        ;** Make the Templates drawer
                        (set #HDTemplatesDest (tackon #HDDocsDest #TemplatesName))
                        (makedir #HDTemplatesDest (infos))

                ;** Make the Clipart drawer
                (set #HDClipartDest (tackon #InsideHDDest #ClipartName))
                (makedir #HDClipartDest (infos))

                ;** Make the Spell drawer
                (set #HDDictDest (tackon #InsideHDDest #SpellName))
                (makedir #HDDictDest)
    (set #HDThesDest #HDDictDest)

                ;** Make the WwTools drawer
                (set #HDWwToolsDest (tackon #InsideHDDest #WwToolsDrawerName))
                (makedir #HDWwToolsDest (infos))

    (complete 10)
        )
)

;** Procedure to dearchive basic prog files (like WwFiles & program)
(procedure @DearchiveProgFiles1
        (
                (working #DearchivingMsg)

                (set #FileSourceName #WordworthSourceName)
                (set #FileSourceDisk #Install1Disk)
                (@GetDisk)
                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #InsideHDDest "/"))
                (@UnpackFiles)

                (set UnpackFile #WwFiles1SourceName)
                (set UnpackDest (cat #WwFiles1Dest "/"))
                (@UnpackFiles)

                (set UnpackFile #WwFiles3SourceName)
                (set UnpackDest (cat #WwFiles3Dest "/"))
                (@UnpackFiles)

                (set UnpackFile #CatalogsSourceName)
                (set UnpackDest (cat #CatalogsDest "/"))
                (@UnpackFiles)
        )
)

;** Procedure to dearchive second set of basic files from disk 2
(procedure @DearchiveProgFiles2
        (
                (set #FileSourceName #WwprogSourceName)
                (set #FileSourceDisk #Install2Disk)
                (@GetDisk)
                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #InsideHDDest "/"))
                (@UnpackFiles)

                (set UnpackFile #WwFiles2SourceName)
                (set UnpackDest (cat #WwFiles2Dest "/"))
                (@UnpackFiles)

                (set UnpackFile #WwHelpSourceName)
        (set UnpackDest (cat #WwHelpDest "/"))
                (@UnpackFiles)
        )
)

;** Dearchive Filter library
(procedure @DearchiveFilterLibrary
        (
          (set #FileSourceName #FiltersSourceName)
    (set #FileSourceDisk #Install2Disk)
    (@GetDisk)
    (set UnPackFile #FileSourceName)
    (set UnPackDest (cat #WwFiles3Dest "/"))
    (@UnpackFiles)
  )
)

;** Procedure to dearchive Custom modules to hard disk
(procedure @DearchiveCustomModulesHD
        (
                (@CreateDrawers)
                (@SetHardDiskDestinations)
        (set #HDLibsDestChoiceMsg #HDLibsDestChoiceMsg1)
        (@CheckLibsDest)

          (@DearchiveScreenFonts)
    (@CheckAmigaGuide)
                (@DearchiveModules)
          (complete 40)
                (@DearchiveProgFiles1)
          (@DearchiveFontSupport)
          (complete 50)
          (@DearchiveProgFiles2)
          (@DearchiveFilterLibrary)
          (@DearchiveGFXFilters)
                (complete 65)
          (@DearchiveExtras)
          (complete 70)
          (@DearchiveSpell)
          (complete 75)
          (@DearchiveThes)
          (complete 80)
        )
)

;** routine to get disk specified in '#FileSourceDisk'
(procedure @GetDisk
        (
                (askdisk
                        (prompt #InsertDiskMsg #FileSourceDisk)
                        (help #diskhelp)
                        (dest #FileSourceDisk)
                )
        )
)

;** Procedure to de-archive screen fonts
(procedure @DearchiveScreenFonts
        (
                (set #Counter 0)
                (while (< #Counter #NumFonts)
                        (set #FontName
                                (select #Counter
                                        #Font1Name
                                        #Font2Name
                                        #Font3Name
                                )
                        )
                        (set #CheckFont (cat #SystemFontsDest ":" #FontName))
                        (if (exists #CheckFont)
                          (
                            (protect #CheckFont "+r+w+e+d")
                          )
                        )
                  (set #Counter (+ #Counter 1))
                )
                (set #FileSourceDisk #Install1Disk)
                (set #FileSourceName #SystemFontsSourceName)
                (@GetDisk)
    (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #SystemFontsDest ":"))
                (@UnpackFiles)
  )
)


;** Procedure to de-archive amigaguide library
(procedure @DearchiveAmigaGuide
        (
                (set #FileSourceName #AmigaGuideSourceName)
                (set #FileSourceDisk #Install1Disk)
                (@GetDisk)
                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #LibsDefault ":"))
                (@UnpackFiles)
  )
)


;** Procedure to de-archive and install Modules
(procedure @DearcMods
        (
                (working #DearchiveModulesmsg)

                (if (= FloppyInstall 1)
                        (
                    (set UnpackFile (cat "RAM:Archives/" #PassModuleOptionName))
                        )
                        (
                                (set #FileSourceDisk #Install1Disk)
                (@GetDisk)

                    (set UnpackFile #PassModuleOptionSourceName)
                  )
                )

          (set UnpackDest (cat #ModulesDest "/") )
          (@UnpackFiles)

                ;now delete it from storage if it exists
                (set #ModOld (tackon #ModDisDest #PassModuleName))
                (if (exists #ModOld)
                        (
                                (delete #ModOld
                                        (optional "force")
                                )
                          (delete (cat #ModOld ".info")
                                (optional "force")
                          )
                        )
                )

                (if (= FloppyInstall 1)
                        (
                    (run (cat "delete RAM:Archives/" #PassModuleOptionName) (safe))
                        )
                )
        )
)

;** Procedure to pass relevant module names to be dearchived
(procedure @DearchiveModules
        (
                (working #DearchiveModulesmsg)

                (set #PassModuleOptionSourceName #ModuleOption1SourceName)
                (set #PassModuleName #Module1Name)
                (set #PassModuleOptionName #ModuleOption1Name)
                (@DearcMods)
                
                (set #PassModuleOptionSourceName #ModuleOption2SourceName)
                (set #PassModuleName #Module2Name)
                (set #PassModuleOptionName #ModuleOption2Name)
                (@DearcMods)
                
                (set #PassModuleOptionSourceName #ModuleOption3SourceName)
                (set #PassModuleName #Module3Name)
                (set #PassModuleOptionName #ModuleOption3Name)
                (@DearcMods)
        )
)


;** get lib destination
(procedure @GetLibDest
        (
                (if (= @user-level 2)
                        (
                                ;** Ask for destination
                                (set #LibsDest
                                        (askdir
                                                (prompt #HDLibsDestChoiceMsg)
                                                (help #HDLibsDestChoiceHelp)
                                                (default LibsPath)
                                        )
                                )
                        )
                        (
                                (set #LibsDest LibsPath)
                        )
                ) ;end if
  )
)

;** Procedure to check Libs destination
(procedure @CheckLibsDest
        (
                (set LibsPath (expandpath (cat #LibsDefault ":")))
        (@GetLibDest)
                (set SystemSpace TotalFontLibSpace)
                (while (< (getdiskspace #LibsDest) SystemSpace)
                        (
        (set #LibsDestSpace (getdiskspace #LibsDest))
                                (if (= @user-level 2)
                        (
                (if (< #LibsDestSpace SystemSpace)
                (
                (message #NoLibSpaceMsg1 #LibsDest
                        #NoLibSpaceMsg2 (/ #LibsDestSpace 1024) #NoLibSpaceMsg3a
                        (/ SystemSpace 1024) #NoLibSpaceMsg3b
                )
                (@GetLibDest)
                )
                        )
                )
                (
                        (abort #LibAbortMsg1 (/ #LibsDestSpace 1024) 
                                #LibAbortMsg2 (/ SystemSpace 1024) #LibAbortMsg3
                        )
                )
        ); endif
      )
    ) ;end while
  )
)


;** Procedure to de-archive and install Font Support
(procedure @DearchiveFontSupport
        (
                (working #DearchiveFontmsg)
                (set n 0)
    ;delete old small digita libraries
    (if (exists (cat #LibsDest "/" #IFlibraryName))
        (
                (delete (cat #LibsDest "/" #IFlibraryName)
                        (optional "force")
                )
        )
    )
    
                (set #FileSourceDisk #Install1Disk)
    (@GetDisk)
    (set UnpackFile #FontType1SourceName)
          (set UnpackDest (cat #LibsDest "/") )
          (@UnpackFiles)

    (set #FileSourceName #UFSTSourceName)
                (set #FileSourceDisk #Install2Disk)
    (@GetDisk)
    (set UnpackFile #FileSourceName)
    (set UnpackDest (cat #WwUFSTDest "/"))
    (@UnpackFiles)

    (set UnpackFile #IntelliSourceName)
    (set UnpackDest (cat #WwAgfaDest "/"))
    (@UnpackFiles)

    (set UnpackFile #WwToolsSourceName)
                (set UnpackDest (cat #WwToolsDest "/"))
    (@UnpackFiles)

    (copyfiles
        (source (cat #Install2Disk ":Utils"))                   ;Copy install font scripts
        (dest "RAM:")                                                                                                                   ;to RAM for later on
        (pattern "FontScript#?")
        (nogauge)
        (optional "force")
    )

                (copyfiles
                        (source #WwToolsDest)                                                                                   ;Copy `InstallOutlines'
                        (dest "RAM:")                                                                                                                   ;to RAM for later on
                        (pattern "InstallOutlines")
                        (nogauge)
                        (optional "nofail")
                )
        )
)

;** Procedure to de-archive and install GFX Filters
(procedure @DearchiveGFXFilters
        (
                (if (= FloppyInstall 1)
                        (
                    (set UnpackFile (cat "RAM:Archives/" #GfxFilter1Name))
                        )
                        (
                                (set #FileSourceDisk #Install2Disk)
                (@GetDisk)
                
                    (set UnpackFile #GfxFilter1SourceName)
                        )
                )

                (working #DearchivingGfxMsg)

          (set UnpackDest (cat #WwPictureFiltersDest "/") )
          (@UnpackFiles)

                (if (= FloppyInstall 1)
            (run (cat "delete RAM:Archives/" #GfxFilter1Name) (safe))
                )
        )
)

(procedure @DearchiveTutorials
        (
                (if (= FloppyInstall 1)
                        (
                    (set #FileSourceName (cat "RAM:Archives/" #CustomExtras1Name))
                        )
                        (
                                (set #FileSourceName #CustomExtras1SourceName)
                                (set #FileSourceDisk #Install2Disk)
                                (@GetDisk)
                        )
                )

                (working #DearchivingMsg)

                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #DocsDest "/" ))
                (@UnpackFiles)

    (if (= FloppyInstall 0)
        (
        ;set default tool type to hard disk dest, for all documents
        (foreach #DocsDest "#?"
                (
                        (tooltype
                                (dest (cat #DocsDest "/" @each-name))
                                (setdefaulttool (cat #InsideHDDest "/" #DocDefaultTool))
                        )
                )
        ); end foreach
                  )
                  (
                    (run (cat "delete RAM:Archives/" #CustomExtras1Name) (safe))
                  )
                )
  )
)


(procedure @DearchiveTemplates
        (
                (if (= FloppyInstall 1)
                        (
                    (set #FileSourceName (cat "RAM:Archives/" #CustomExtras2Name))
                        )
                        (
                                (set #FileSourceName #CustomExtras2SourceName)
                                (set #FileSourceDisk #Install2Disk)
                                (@GetDisk)
                        )
                )

                (working #DearchivingMsg)

                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #TemplatesDest "/" ))
                (@UnpackFiles)

                (if (= FloppyInstall 1)
            (run (cat "delete RAM:Archives/" #CustomExtras2Name) (safe))
                )
        )
)
                

(procedure @DearchiveClipArt
        (
                (if (= FloppyInstall 1)
                        (
                    (set #FileSourceName (cat "RAM:Archives/" #CustomExtras3Name))
                        )
                        (
                                (set #FileSourceName #CustomExtras3SourceName)
                                (set #FileSourceDisk #Install2Disk)
                                (@GetDisk)
                        )
                )

                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #ClipartDest "/" ))
                (@UnpackFiles)

                (if (= FloppyInstall 1)
            (run (cat "delete RAM:Archives/" #CustomExtras3Name) (safe))
                )
        )
)


;** Procedure to de-archive and install Extras
(procedure @DearchiveExtras
        (
        (@DearchiveTutorials)
        (@DearchiveTemplates)
        (@DearchiveClipArt)
        )
)

;** Install Spell files
(procedure @DearchiveSpell
        (
                (if (= FloppyInstall 1)
                        (
                    (set #FileSourceName (cat "RAM:Archives/" #DictionaryName))
                        )
                        (
                                (set #FileSourceName #DictionarySourceName)
                                (set #FileSourceDisk #Install3Disk)
                                (@GetDisk)
                        )
                )

                (working #DearchivingSpellmsg)

                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #DictDest "/" ))
                (@UnpackFiles)

                (if (= FloppyInstall 1)
            (run (cat "delete RAM:Archives/" #DictionaryName) (safe))
                )
        )
)

;** Install Thes files
(procedure @DearchiveThes
        (
                (if (= FloppyInstall 1)
                        (
                    (set #FileSourceName (cat "RAM:Archives/" #ThesaurusName))
                        )
                        (
                                (set #FileSourceName #ThesaurusSourceName)
                                (set #FileSourceDisk #Install3Disk)
                                (@GetDisk)
                        )
                )

                (working #DearchivingThesmsg)

                (set UnpackFile #FileSourceName)
                (set UnpackDest (cat #ThesDest "/" ))
                (@UnpackFiles)

                (if (= FloppyInstall 1)
            (run (cat "delete RAM:Archives/" #ThesaurusName) (safe))
                )
  )
)


;** Routine to preserve text files (Librarian, UserDictionary, AutoCorrect)
(procedure @PreserveTextFiles
        (
                (@SetupDestinationsHD)
                (if (exists (tackon #InsideHDDest #OldAutoCorrectName))
                        (
                                (set #OldAutoCorrect (tackon #InsideHDDest #OldAutoCorrectName))
                                (set #TempAutoCorrect (cat #InsideHDDest "/" #TempAutoCorrectName))
                                (rename #OldAutoCorrect #TempAutoCorrect)
                        )
                )
                (if (exists (tackon #HDDictDest #OldUserDictName))
                        (
                                (set #OldUserDict (tackon #HDDictDest #OldUserDictName))
                                (set #TempUserDict (tackon #HDDictDest #TempUserDictName))
                                (rename #OldUserDict #TempUserDict)
                        )
                )
    (set #TextPreservedFlag 1)
  )
)

;** Routine to retrieve old text files
(procedure @RetrieveOldTextFiles
        (
                (if (exists (tackon #InsideHDDest #TempAutoCorrectName))
                        (
                                (set #OldAutoCorrect (tackon #InsideHDDest #OldAutoCorrectName))
                                (set #TempAutoCorrect (cat #InsideHDDest "/" #TempAutoCorrectName))
                                (delete #OldAutoCorrect
                                        (optional "force")
                                )
                                (rename #TempAutoCorrect #OldAutoCorrect)
                        )
                )
                (if (exists (tackon #HDDictDest #TempUserDictName))
                        (
                                (set #OldUserDict (tackon #HDDictDest #OldUserDictName))
                                (set #TempUserDict (cat #HDDictDest "/" #TempUserDictName))
                                (delete #OldUserDict
                                        (optional "force")
                                )
                                (rename #TempUserDict #OldUserDict)
                        )
                )
        )
)


;** This routine will delete the modules drawer
(procedure @DeleteOldWordworth3
        (
                (working #DeleteOldmsg)
                (set ChosenDrawer (tackon #DestDrawer (cat #DrawerName "/" #ModulesName)))
                (set DeleteDrawer (cat "delete " ChosenDrawer " all force"))
                (Run DeleteDrawer)
        )
)

(procedure @CheckDisks
        (
                ;** Check to make sure that none of the Wordworth disks
                ;** are in the internal drive before creating blank ones.
                (set NumberDisks (+ NumberInstallDisks NumNewWwDisks))
                (set DiskBlank 1)
                (set n 0)
                (until (OR (= n NumberDisks) (= DiskBlank 0))
                        (
                                (set #CheckDiskName
                                        (select n
                                                #Install1Disk
                                                #Install2Disk
                                                #Install3Disk
                                                #NewWwDiskName
                                                #NewWwSysDiskName
                                                #NewWwOutlinesDiskName
                                                #NewWwDictDiskName
                                        )
                                )
                                (if (= (getassign "df0" "d") (cat #CheckDiskName ":"))
                                        (       ;disk is not blank
                                                (set DiskBlank 0)
                                        )
                                )
                                (set n (+ n 1))
                        )
                )
        )
)


;** Format and name the disk given in #FormatDiskName
(procedure @FormatDisk
        (
                (working #FormatWorkingMsg)
                ;*** USE 2.0 FORMAT COMMAND ***
                (if (= FormatChoice 0)
                        (
                                (set FormatCheck
                                        (run ("Format drive=df0: name=%s FFS NOICONS" #FormatDiskName))
                                )
                        )
                        (
                                (set FormatCheck
                                        (run ("Format drive=df0: name=%s FFS QUICK NOICONS" #FormatDiskName))
                                )
                        )
                )
    (if (OR (> FormatCheck 0) (< FormatCheck 0))
        (set NoError 1)
                (set NoError 0)
    )
                (if (= NoError 0)
                        (
                                (if (= #FormatDiskName #NewWwDiskName)
                                        (
                                                (run "Install2.1 df0:")
                                                (run "resident Install2.1 REMOVE")
                                        )
                                )
                        )
                ); endif
        )
)

;** routine to check disk in drive ok and format it if so
(procedure @makedisk
        (
    (set NoError 1)

    (while (= NoError 1)
        (
                    ;** Make sure that the install disks are not in the drive
                    (run "Wait 6")  ;Wait a bit for disk access to stop
                    (@CheckDisks)
                  (if (= DiskBlank 0)
                    (
                      (message #NotBlankMsg1 #CheckDiskName #NotBlankMsg2)
                    )
                    (
                      ;** Else for each disk in turn, Format it
                      (set #FormatDiskName
                        (select x
                        #NewWwDiskName
                            #NewWwSysDiskName
                            #NewWwOutlinesDiskName
                            #NewWwDictDiskName
                          )
                        )
                        (set NoError 1)
                        (@FormatDisk)
                        (if (= NoError 0)
                        (
                        (set x (+ x 1))
                        )
                        (
                        (message #FormatError (help #FormatErrorHelp))
                        )
                        );endif
                )
                );endif
        )
    );endwhile
  (working #FloppyWorkingMsg)
  )
)

;** routine to make disk 1 (WordworthLite)
(procedure @CreateDisk1
        (
        ;** USE INSTALL DISK 1 and copy archives to RAM:
                (set #FileSourceDisk #Install1Disk)
                (@GetDisk)

                (makedir "RAM:Archives")
    (set UnpackFileDisk (cat #Install1Disk ":Archive"))
    (@CopyArchives)

    (if (OR (= @language "français") (= @language "deutsch"))
        (
                (copyfiles
                        (source (cat #Install1Disk ":" #LocaleName))
                        (dest (cat "RAM:" #LocaleName))
                        (all)
                        (optional "force")
                )

                                ;** delete the utilities.catalog 'cos it's not needed on floppy
          (delete 
                (cat "RAM:" #LocaleName "/catalogs/" Language "/sys/utilities.catalog")
                (optional "force")
          )
        )
    )

    (copyfiles
        (source (cat #Install1Disk ":Libs"))
        (dest "RAM:Libs")
        (all)
        (optional "force")
    )

    (copyfiles
      (source (cat #Install1Disk ":Devs"))                      ;copy devs from install disk
      (dest "RAM:Devs")
      (all)
      (optional "force")
    )

    (copyfiles                                                                                                                                  ;copy env-archive from install disk
      (source (cat #Install1Disk ":prefs/env-archive/sys"))
      (dest "RAM:env-archive")
      (all)
      (optional "force")
    )

    (copyfiles                                                                                                                                  ;copy startup-seq
      (source (cat #Install1Disk ":Archive/Boot"))
      (dest "RAM:S")
      (pattern "startup-sequence")
      (optional "force")
    )


        ;** CREATE DISK
                (set x 0)
    (message #BlankDiskWarning)
          (@makedisk)

    (set #FileSourceDisk #NewWwDiskName)
    (@GetDisk)
                (working #Creatingmsg #NewWwDiskName)

    (makedir #CatalogsLangDest)
    (makedir #CatalogsDest)
    (makedir #LibsDest)
    (makedir #ModulesDest (infos))
    (makedir #ModDisDest (infos))
                (makedir #WwDevsDest)
                (makedir #WwPrefsDest)
                (makedir #WwEnvArcDest)
                (makedir #WwEnvArcSysDest)
                (makedir #WwSDest)


        ;** Now dearchive files to NewWwDisk
    (if (OR (= @language "français") (= @language "deutsch"))
        (
                (makedir #LocaleDest)
                (copyfiles
                        (source "RAM:" #LocaleName)
                        (dest (cat #NewWwDiskName ":" #LocaleName))
                        (all)
                        (optional "force")
                        (nogauge)
                )
                                (run (cat "delete RAM:" #LocaleName " all") (safe))
        )
    )

    (copyfiles
        (source "RAM:Libs")     ;copy libs from ram
        (dest (cat #NewWwDiskName ":Libs"))
        (all)
        (optional "force")
    )
                (run "delete RAM:Libs all" (safe))

    (copyfiles
      (source "RAM:Devs")                                                                               ;copy devs from ram
      (dest (cat #NewWwDiskName ":Devs"))
      (all)
      (optional "force")
    )
                (run "delete RAM:Devs all" (safe))

    (copyfiles                                                                                                                  ;copy env-archive from ram
      (source "RAM:Env-Archive")
      (dest (cat #NewWwDiskName ":prefs/env-archive/sys"))
      (all)
      (optional "force")
    )
                (run "delete RAM:Env-Archive all" (safe))

    (copyfiles                                                                                                                  ;copy startup-seq from ram
      (source "RAM:s")
      (dest (cat #NewWwDiskName ":s"))
      (pattern "startup-sequence")
      (optional "force")
    )
                (run "delete RAM:S all" (safe))


                (set UnpackFile (cat "RAM:Archives/" #WordworthName))   ;unpack start stub
                (set UnpackDest (cat #NewWwDiskName ":"))
                (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #WordworthName) (safe))

;               (set UnpackFile (cat "RAM:Archives/" #PrefsName))                       ;unpack extra  prefs
;               (set UnpackDest (cat #WwEnvArcSysDest "/"))
;               (@UnpackFiles)
;               (run (cat "delete RAM:Archives/" #PrefsName) (safe))

                (set UnpackFile (cat "RAM:Archives/" #AmigaGuideName));unpack amigaguide.lib
                (set UnpackDest (cat #LibsDest "/"))
                (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #AmigaGuideName) (safe))
    
    (set UnpackFile (cat "RAM:Archives/" #ASLName))                             ;unpack asl
    (set UnpackDest (cat #LibsDest "/"))
    (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #ASLName) (safe))

    (set UnpackFile (cat "RAM:Archives/" #SystemFontsName))     ;unpack sysfonts
    (set UnpackDest (cat #SysFontsDest "/"))
    (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #SystemFontsName) (safe))

    (set UnpackFile (cat "RAM:Archives/" #CatalogsName))        ;unpack catalogs
    (set UnpackDest (cat #CatalogsDest "/"))
    (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #CatalogsName) (safe))

    (set UnpackFile "RAM:Archives/Boot/system.lzh")
    (set UnpackDest (cat #NewWwDiskName ":"))
    (@UnpackFiles)
                (run "delete RAM:Archives/Boot/system.lzh" (safe))

    (set UnpackFile "RAM:Archives/Boot/c.lzh")
    (set UnpackDest (cat #NewWwDiskName ":"))
    (@UnpackFiles)
                (run "delete RAM:Archives/Boot/c.lzh" (safe))

    (set UnpackFile "RAM:Archives/Boot/libs.lzh")
    (set UnpackDest (cat #NewWwDiskName ":"))
    (@UnpackFiles)
                (run "delete RAM:Archives/Boot/libs.lzh" (safe))

    (set UnpackFile "RAM:Archives/Boot/devs.lzh")
    (set UnpackDest (cat #NewWwDiskName ":"))
    (@UnpackFiles)
                (run "delete RAM:Archives/Boot/devs.lzh" (safe))

    (set UnpackFile "RAM:Archives/Boot/l.lzh")
    (set UnpackDest (cat #NewWwDiskName ":"))
    (@UnpackFiles)
                (run "delete RAM:Archives/Boot/l.lzh" (safe))

          (@DearchiveModules)                                                                           ; Draw Tools, Picture & TxtFX

                (set UnpackFile (cat "RAM:Archives/" #WwFiles1Name))            ;all WWfiles minus WWSpell.lib
                (set UnpackDest (cat #WwFilesDest "/"))
                (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #WwFiles1Name) (safe))

                (set UnpackFile (cat "RAM:Archives/" #WwFiles3Name))            ;toolbar icons
                (set UnpackDest (cat #WwFilesDest "/"))
                (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #WwFiles3Name) (safe))

    (set UnpackFile (cat "RAM:Archives/" #FontType1Name))               ;unpack Intellifont.lib
          (set UnpackDest (cat #LibsDest "/"))
          (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #FontType1Name) (safe))

                (tooltype
                        (dest #WwToolDest)
                        (settooltype #DocsTool #DocsDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #ClipartTool #ClipartDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #DeviceTool #Parallel)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #FiltersTool #WwFiltersDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #ModulesTool #ModulesDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #HelpTool #WwHelpDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #CatalogsTool #CatalogsLangDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #WwFilesTool #WwFilesDest)
                )
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #WwSpellLibTool #WwFiles2Dest)
                )
                (set #WwSystemDest (cat #NewWwSysDiskName ":"))
                (tooltype
                        (dest #WwToolDest)
                        (settooltype #WwSystemTool #WwSystemDest)
                )

  ;** Check ENVARC: for Wordworth/wwfonts, creating it if it does not exist
    (set #WwEnvDrawer (cat #NewWwDiskName ":prefs/env-archive/Wordworth"))
    (if (NOT (exists #WwEnvDrawer))
      (makedir #WwEnvDrawer (safe))
    )
    ;setup Wordworth path
    ( ;create 'wwfonts' variable with #WwFontsDest in it
      (textfile
        (dest (cat #WwEnvDrawer "/WwFonts"))
        (append #WwFontsDest)
        (safe)
      )
    )
  ;do the same for ENV:
    (set #WwEnvDrawer (cat "RAM:ENV/Wordworth"))
    (if (NOT (exists #WwEnvDrawer))
      (makedir #WwEnvDrawer (safe))
    )
    ( ;create 'WwFonts' variable with #WwFontsDest in it
      (textfile
        (dest (cat #WwEnvDrawer "/WwFonts"))
        (append #WwFontsDest)
        (safe)
      )
    )

                (message (cat #FormatDiskName #FormatCompleteMsg1 #FormatDiskName #FormatCompleteMsg2))
    (run "delete RAM:Archives/#? force")
  )
)


;** routine to make disk 2 (Ww3System)
(procedure @CreateDisk2
        (
        ;** USE INSTALL DISK 2
                (set #FileSourceDisk #Install2Disk)
                (@GetDisk)
    (set UnpackFileDisk (cat #Install2Disk ":Archive"))
                (@CopyArchives)

        ;** CREATE DISK
                (set x 1)
    (message #BlankDiskWarning)
          (@makedisk)

    (set #FileSourceDisk #NewWwSysDiskName)
    (@GetDisk)

                (working #Creatingmsg #NewWwSysDiskName)

    (makedir #WwFiles2Dest)
    (makedir #ClipartDest (infos))
                (makedir #WwToolsDest (infos))


        ;** Now dearchive files to NewWwSysDisk
                (set UnpackFile (cat "RAM:Archives/" #WwProgName))              ;WWProg tool
                (set UnpackDest (cat #NewWWSysDiskName ":"))
                (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #WwProgName))

                (@DearchiveClipArt)

                (set UnpackFile (cat "RAM:Archives/" #WwFiles2Name))    ;WWSpell.library
                (set UnpackDest (cat #WwFiles2Dest "/"))
                (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #WwFiles2Name))

                (set UnpackFile (cat "RAM:Archives/" #WwToolsName))             ;WwTools stuff
                (set UnpackDest (cat #WwToolsDest "/"))
                (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #WwToolsName))

                (message (cat #FormatDiskName #FormatCompleteMsg1 #FormatDiskName #FormatCompleteMsg2))
;    (run "delete RAM:Archives/#? force")
        )
)

;** routine to make disk 3 (Ww3Outlines)
(procedure @CreateDisk3
        (
        ;** CREATE DISK
                (set x 2)
    (message #BlankDiskWarning)
          (@makedisk)

    (set #FileSourceDisk #NewWwOutlinesDiskName)
    (@GetDisk)

                (working #Creatingmsg #NewWwOutlinesDiskName)

    (makedir #WwFontsDestOutlines (infos))
    (makedir #DocsDest (infos))
    (makedir #TemplatesDest (infos))
    (makedir #WwFontsDest)
    (makedir #WwAgfaDest (infos))
    (makedir #WwPSDest)
    (makedir #WwTTDest)
    (makedir #WwHelpDest)
    (makedir #WwFiltersDest)
    (makedir #WwFilterLibDest)
    (makedir #WwPictureFiltersDest)

        ;** Now dearchive files to NewWwOutlinesDisk
    (@DearchiveTutorials)
    (@DearchiveTemplates)
    (@DearchiveGfxFilters)                                                              ; Only CGM
    
    (set UnPackFile (cat "RAM:Archives/" #FiltersName))                 ;Filter.library
    (set UnPackDest (cat #WwFilterLibDest "/"))
    (@UnpackFiles)
                (run (cat "delete RAM:Archives/" #FiltersName) (safe))

                (set UnpackFile (cat "RAM:Archives/" #WwHelpName))
        (set UnpackDest (cat #WwHelpDest "/"))
                (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #WwHelpName))

    (set UnpackFile (cat "RAM:Archives/" #UFSTName))
    (set UnpackDest (cat #WwUFSTDest "/"))
    (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #UFSTName))

    (set UnpackFile (cat "RAM:Archives/" #IntelliName))
    (set UnpackDest (cat #WwAgfaDest "/"))
    (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #IntelliName))

    (set UnpackFile (cat "RAM:Archives/" #FloppyOtagsName))
    (set UnpackDest (cat #WwUFSTDest "/"))
    (@UnpackFiles)
    (run (cat "delete RAM:Archives/" #IntelliName))

                (message (cat #FormatDiskName #FormatCompleteMsg1 #FormatDiskName #FormatCompleteMsg2))
    (run "delete RAM:Archives/#? force")
        )
)

;** routine to make disk 4 (Ww3Spell)
(procedure @CreateDisk4
        (
        ;** USE INSTALL DISK 3
                (set #FileSourceDisk #Install3Disk)
                (@GetDisk)
    (set UnpackFileDisk (cat #Install3Disk ":Archive"))
                (@CopyArchives)

        ;** CREATE DISK
                (set x 3)
    (message #BlankDiskWarning)
          (@makedisk)

    (set #FileSourceDisk #NewWwDictDiskName)
    (@GetDisk)

                (working #Creatingmsg #NewWwDictDiskName)

    (makedir #DictDest (infos))


        ;** Now dearchive files to NewWwSpellDisk
    (@DearchiveSpell)
    (@DearchiveThes)

                (message (cat #FormatDiskName #FormatCompleteMsg1 #FormatDiskName #FormatCompleteMsgLast))
    (run "delete RAM:Archives/#? force")
        )
)

;** Check that ASL library is at least version 2.1 (if not replace)
(procedure @CheckASL
        (
                (set ASLVersion (/ (getversion (cat #LibsDefault ":ASL.library")) 65536))
                (if (< ASLVersion 38)
                        (
        (if (= @user-level 2)
                (
                        (set InstallASLLibrary
                          (askbool
                                (prompt #OldASLLibraryMsg)
                        (choices #InstallASLChoice1 #InstallASLChoice2)
                        (help #OldASLLibraryHelp)
                                (default 1)
                          )
                        )
                        (if (= InstallASLLibrary 1)
                        (
                        (@InstallASL)
                        (set ASLOK 1)
                          )
                                (
                                                        (set ASLOK 0)
                    )
                        ) ;end if
                      )
                      (
                        (@InstallASL)
                        (set ASLOK 1)
                      )
                    ) ;end if
                  )
                  (; else
                        (set ASLOK 1)
                  )
                ) ;endif
        )
)

;** Check that AmigaGuide library is at least version 34.11 (if not replace)
(procedure @CheckAmigaGuide
        (
                (set AmigaGuideVersion (/ (getversion (cat #LibsDefault ":amigaguide.library")) 65536))
                        (if (< AmigaGuideVersion 35)
                        (
        (if (= @user-level 2)
                (
                        (set InstallAmigaGuideLibrary
                          (askbool
                                (prompt #OldAmigaGuideLibraryMsg)
                        (choices #InstallAGChoice1 #InstallAGChoice2)
                        (help #OldAmigaGuideLibraryHelp)
                                (default 1)
                          )
                        )
                        (if (= InstallAmigaGuideLibrary 1)
                        (
                        (@DearchiveAmigaGuide)
                          )
                        );end if
                      )
                      (
                        (@DearchiveAmigaGuide)
                      )
                    ) ;end if
                  )
                ) ;endif
        )
)


;** Procedure to install the asl library
(procedure @InstallASL
        (
    (set #FileSourceName #ASLSourceName)
    (set #FileSourceDisk #Install1Disk)
    (@GetDisk)

    (set UnpackFile #FileSourceName)
    (set UnpackDest (cat #LibsDefault ":"))
                (delete (tackon UnpackDest "asl.library"))
    (@UnpackFiles)
        )
)

;** Check that diskfont library is at least version 2.1 (if not replace)
(procedure @CheckDiskFont
        (
                (set InstalledDiskFont 0)
                (set DiskFontVersion (/ (getversion (cat #LibsDefault ":diskfont.library")) 65536))
                (if (< DiskFontVersion 37)
                        (
        (if (= @user-level 2)
                (
                        (set InstallDiskFontLibrary
                          (askbool
                                (prompt #OldDiskFontLibraryMsg)
                        (choices #InstallDiskFontChoice1 #InstallDiskFontChoice2)
                        (help #OldDiskFontLibraryHelp)
                                (default 1)
                          )
                        )
                        (if (= InstallDiskFontLibrary 1)
                        (
                        (@InstallDiskFont)
                        (set DiskFontOK 1)
                          )
                                (
                                                        (set DiskFontOK 0)
                    )
                        ) ;end if
                      )
                      (
                        (@InstallDiskFont)
                        (set DiskFontOK 1)
                      )
                    ) ;end if
                  )
                  (; else
                        (set DiskFontOK 1)
                  )
                ) ;endif
        )
)

;** Procedure to install the diskfont library
(procedure @InstallDiskFont
        (
    (set #FileSourceName #DiskFontSourceName)
    (set #FileSourceDisk #Install1Disk)
    (@GetDisk)

    (set UnpackFile #FileSourceName)
    (set UnpackDest (cat #LibsDefault ":"))
                (delete (tackon UnpackDest "diskfont.library"))
    (@UnpackFiles)
    (set InstalledDiskFont 1)
        )
)

;## Routine to install printer and fonts
(procedure @AddNewPrinter
        (
    ; Copy stuff to RAM first
    (askdisk
      (prompt #InsertDiskMsg #Install3Disk)
      (help #diskhelp)
      (dest #Install3Disk)
    )
                (copyfiles
                        (source (cat #Install2Disk ":Utils"))
                        (dest "RAM:")
                        (pattern "Writeprefs3")
                        (nogauge)
                        (optional "nofail")
                )
                (copyfiles
                        (source (cat #Install2Disk ":Utils"))
                        (dest "RAM:")
                        (pattern "select")
                        (nogauge)
                        (optional "nofail")
                )
                (copyfiles
                        (source (cat #Install2Disk ":Utils"))
                        (dest "RAM:")
                        (pattern "WwPrinterList")
                        (nogauge)
                        (optional "nofail")
                )

    ;** Delete all in #RamTempFile
    (delete (cat #RamTempFile " all"))

    (set ChosenDriver "Generic")

    (set #DriverSource (cat #Install3Disk ":Drivers"))

    (if (= FloppyInstall 1)
        (
                    ;** FloppyDiskDriverDest
                    (set #DriverDest (cat #NewWwDiskName ":Devs/Printers"))
                  )
                  (
                    ;** HardDiskDriverDest
                    (set #DriverDest "DEVS:Printers")
                                (set #CheckGeneric (cat #DriverDest "/" ChosenDriver))
                                (if (exists #CheckGeneric)
                                  (
                                    (protect #CheckGeneric "+r+w+e+d")
                                  )
                                )
                  )
                )

    (working #WorkingPrintermsg)
    (set SelectPrt
      (cat "Ram:select Ram:WwPrinterList")
    )
    (run SelectPrt (safe))

    (set ChosenDriver (getenv "wwDriver"))
    (set TopBord (getenv "wwTop"))
    (set BotBord (getenv "wwBottom"))
    (set LeftBord (getenv "wwLeft"))
    (set RightBord (getenv "wwRight"))

    (complete 85)
    (askdisk
      (prompt #InsertDiskMsg #Install3Disk)
      (help #diskhelp)
      (dest #Install3Disk)
    )
    (working #WorkingPrintermsg)
    (copyfiles                                                                                          ; copy driver to ram
      (source #DriverSource)
      (dest #RamTempFile)
      (pattern ChosenDriver)
      (optional "force")
      (nogauge)
    )

    ;Now decompress Driver 'ChosenDriver' to destination '#RamTempFile'
    (working #Unpackmsg4)
    (set ExpandName (tackon #RamTempFile ChosenDriver))

    (set #ArchiveError 0)
    (set RunLHA
      (cat "LHA e \"" ExpandName "\" \"" #RamTempFile "/\"")
    )
                (set #ArchiveError (run RunLHA))
                (if (> #ArchiveError 0)
                        (
                                (set #ArchiveAbortMsg (cat #ArchiveAbortMsg1 ExpandName #ArchiveAbortMsg2))
                                (abort #ArchiveAbortMsg)
                        )
                )
    (delete ExpandName)

    (run "List " #RamTempFile " LFORMAT %s >ENV:wwDriver")
                (run "resident list REMOVE")                                    ;remove resident List

    (if (= @pretend 1)
      (
        (Run "setenv wwDriver Generic.lzh" (safe))
      )
    )

    (set Driver (getenv "wwDriver"))
    (set DriverLen (strlen Driver))
    (set DriverLen (- DriverLen 1))

    (set ChosenDriver
      (substr Driver 0 DriverLen)
    )

    (if (= FloppyInstall 0)
                  (
                        ;** On hard disk, copy driver to devs: now!!
                    (copyfiles
                      (source #RamTempFile)
                      (dest #DriverDest)
                      (pattern ChosenDriver)
                      (optional "force")
                    )
                  )
    )

          (set #Drivermsg 1) ; Flag to display driver message at end of installation
  )
)


(procedure @InstallWwFonts
        (
                (if (= #UserNovice 1)
                        (user 0)
                )

                (if (= #InstallationType "Wordworth")
                        (
                                (working #InstallingFontsmsg)
                                (execute "RAM:FontScript")
                                (delete "RAM:FontScript")
        
                          (if (exists #BulletOutlinesDest)
                                (
                                        (
                                                        (set #InstallBO
                                                                (askbool
                                                                        (prompt #InstallBOPrompt)
                                                                        (choices #InstallBOChoice1 #InstallBOChoice2)
                                                                        (help #InstallBOPrompt-Help)
                                                                        (default 1)
                                                                )
                                                        )
                                                        (if (= #InstallBO 1)
                                                                (
                                                                        (working #InstallingFontsmsg)
                                                                        (execute "RAM:FontScript2")
                                                                        (delete "RAM:FontScript2")
                                                                )
                                                        )
                                                )
                                        )
                                ); end if
                          (set #OldWordworthSEDrawer (cat #DestDrawer "/" #WordworthSEDrawerName))
                          (set #OldWordworth2Drawer (cat #DestDrawer "/" #Wordworth2DrawerName))
                          (if (OR (exists #OldWordworthSEDrawer) (exists #OldWordworth2Drawer))
                                (message #InstallOldWordworthFontsmsg)
                          )
                                (delete "RAM:InstallOutlines")
                        )
                )
        )
)


;####### BEGINNING OF MAIN ROUTINE
;** Initial Checks

;** Check OS version
(if (< (/ (getversion) 65536) 37)
        (abort #BadKick)
)

(set #Drivermsg 0)
(set #InstallationType (getenv "Wordworth/install"))

(welcome)

(working #CheckStartup)

;** Create temp file in ram: for files
(if (not (exists #RamTempFile))
        (
                (makedir #RamTempFile (safe))
        )
)

(set #EnvArcDest (getassign "ENVARC" "a"))

;** Make sure there is an Env-Archive directory and logical assign
(if (= #EnvArcDest "")
        (
                (set envdisk "SYS:Env-Archive")
                (if (NOT (exists envdisk))
                        (
                                (set envdisk "SYS:Prefs/Env-Archive")
                                (if (NOT (exists envdisk))
                                        (
                                                (makedir envdisk)
                                                (if (> @user-level 1)
                                                        (
                                                                (set envdisk
                                                                        (askdir
                                                                                (prompt #AskEnvArc)
                                                                                (help #AskEnvArcHelp)
                                                                                (default envdisk)
                                                                        )
                                                                )
                                                        )
                                                )
                                        )
                                )
                        )
                )

                ;** Create ENVARC assign in user-startup
                (startup "Env-Archive"
                        (prompt #AskEnvArcStartup)
                        (help #AskStartupArcHelp )
                        (command ("Assign >NIL: ENVARC: %s" envdisk))
                )
                (makeassign "ENVARC" envdisk (safe))
          (set #EnvArcDest envdisk)
        )
)

(set #EnvDest (getassign "ENV" "a"))

;** Make sure there is an ENV directory and logical assign
(if (= #EnvDest "")
        (
                (set envdisk "RAM:ENV")
                (if (NOT (exists envdisk))
                        (makedir envdisk)
                )

                ;** Create ENV: assign in user-startup
                (startup "Ram:ENV"
                        (prompt #AskEnvStartup)
                        (help #AskEnvStartupHelp )
                        (command ("Assign >NIL: ENV: %s\n" envdisk) "c:Copy >NIL: ENVARC: ENV: ALL NOREQ")
                )
                (makeassign "ENV" envdisk (safe))
          (set #EnvDest envdisk)
        )
)

(set #FileSourceDisk #Install1Disk)
(@GetDisk)

(run (cat "resident " #Install1Disk ":Utils/Format")) ;make Format resident
(run (cat "resident " #Install1Disk ":Utils/Wait"))     ;make Wait resident
(run (cat "resident " #Install1Disk ":Utils/LHA"))              ;make LHA resident
(run (cat "resident " #Install1Disk ":Utils/Install2.1")) ;make Install resident

(run (cat "resident " #Install1Disk ":c/list"))                         ;make list resident
(run (cat "resident " #Install1Disk ":c/delete"))               ;make delete resident

(set #FullPath (expandpath "sys:"))
(if (= #FullPath (cat #Install1Disk ":"))
        (set #DiskDefault 1)
        (set #DiskDefault 0)
)


(if (= #InstallationType "Printer")
        (
    (if
            (askchoice
              (prompt #DestChoicePrinterPrompt)
                    (choices #HardDiskChoiceMsg
           #FloppyChoiceMsg
          )
              (help #DestChoicePrinterHelp)
              (default #DiskDefault)
            )
      (set FloppyInstall 1)
      (set FloppyInstall 0)
                )
                (@AddNewPrinter)
        )
        (
    ; ### START OF MAIN INSTALLATION
    ;** set novice user to expert briefly
    (set #UserNovice 0)
    (if (= @user-level 0)
      (
        (user 2)
        (set #UserNovice 1)
      )
    )

    (if
      (askchoice
        (prompt #DestChoicePrompt)
        (choices #HardDiskChoiceMsg
             #FloppyChoiceMsg
        )
        (help #DestChoiceHelp)
        (default #DiskDefault)
      )

    ; ### INSTALL ON FLOPPIES
      (
        (set FloppyInstall 1)
        ;** set novice user back to novice
        (if (= #UserNovice 1)
          (user 0)
        )
        (working #FloppyDiskWorkingMsg)

                                (@SetFloppyDiskDestinations)

                                (if (>= @user-level 2) ;expert only
                                        (
                                                (set FormatChoice
                                                        (askchoice
                                                                (prompt #FormatChoiceprompt)
                                                                (choices #FormatChoicemsg1 #FormatChoicemsg2)
                                                                (help #FormatChoice-help)
                                                                (default 0)
                                                        )
                                                )
                                        )
                                )

                    (if (= @user-level 0)
                      (
                        (user 2)
                        (set #UserNovice 1)
                      )
                    )

                                (complete 10)

                    (message (cat #FloppyBackupsMsg)
                  (help #FloppyWarningHelp)
                    )

                                (@CreateDisk1)
                                (complete 20)
                                (@CreateDisk2)
                                (complete 35)
                                (@CreateDisk3)
                                (complete 55)
                                (@CreateDisk4)
                                (complete 75)


        ;** set novice user back to novice
        (if (= #UserNovice 1)
          (user 0)
        )
        (set FloppyFinished 1)
        (set @default-dest "")

        (@AddNewPrinter)
                                (complete 80)

                        ;** On floppy, copy driver to boot disk at end
                    (askdisk
                      (prompt #InsertDiskMsg #NewWwDiskName)
                      (help #diskhelp)
                      (dest #NewWwDiskName)
                                )
                    (copyfiles
                      (source #RamTempFile)
                      (dest #DriverDest)
                      (pattern ChosenDriver)
                      (optional "force")
                    )

        (complete 90)
        (working #Installingmsg1)

      ;** Lets set the WordworthPrefs file
        (set #PrefsDest (cat #NewWwDiskName ":WordworthPrefs"))
        (run
          (cat "RAM:writeprefs3 \"" #PrefsDest "\" \"" #DictDest "\" \"" #ThesDest "\" \"" ChosenDriver "\" \"" TopBord "\" \"" BotBord "\" \"" LeftBord "\" \"" RightBord "\" \"" #TemplatesDest "\""
        ))
       )



    ; ### INSTALL ON HARD DISK
      (
        (set ASLOK 0)
        (set DiskFontOK 0)
        (set #TextPreservedFlag 0)
        ;** set novice user back to novice
        (if (= #UserNovice 1)
          (user 0)
        )

        (@CheckDiskFont)
        (@CheckASL)
        (if (AND (= ASLOK 1) (= DiskFontOK 1))
          (
            (working #HardDiskWorkingMsg)
                  ;set amount of disk space needed in bytes
                  (set HDSpaceNeededBytes (* (* FullHDSpace 1024) 1024))
                  (set TotalFontLibSpace FullHDLibsSpace)

                  (@FindHDDest)                           ;ask for destination drawer
                                                (@SetHardDiskDestinations)
                        (@DearchiveCustomModulesHD) ;install all modules

            (set @default-dest #DestDrawer)
          )
          (
            (if (AND (= ASLOK 0) (= DiskFontOK 0))
                (
                        (abort #BadASLandDiskFont)
                )
            )
            (if (= ASLOK 0)
                (
                        (abort #BadASL)
                )
              (
                (abort #BadDiskFont)
              )
            )
          )
        ); endif

        (if (= #TextPreservedFlag 1)
                (
                        (@RetrieveOldTextFiles)
                )
        )
        ;** Check env for Wordworth/wwfonts, creating it if it does not exist
        (set #WwEnvArcDest (cat #EnvArcDest "/" #WwDrawerName))
        (if (NOT (exists (#WwEnvArcDest)))
          (makedir #WwEnvArcDest (safe))
        )
        ;setup Wordworth path
        ( ;create 'wwfonts' variable with #HDWwFontsDest in it
          (textfile
            (dest (cat #WwEnvArcDest "/" #WwFontsEnvName))
            (append #HDWwFontsDest)
            (safe)
          )
        )

        ;do the same for env:
        (set #WwEnvDest (cat #EnvDest "/" #WwDrawerName))
        (if (NOT (exists (#WwEnvDest)))
          (makedir #WwEnvDest (safe))
        )
        (;create 'WwFonts' variable with #HDWwFontsDest in it
          (textfile
            (dest (cat #WwEnvDest "/" #WwFontsEnvName))
            (append #HDWwFontsDest)
            (safe)
          )
        )

                (tooltype
                                        (dest (cat #InsideHDDest "/Wordworth"))
                                        (settooltype "CLIPART" #ClipartDest)
                                )
                                (tooltype
                                        (dest (cat #InsideHDDest "/Wordworth"))
                                        (settooltype "DOCS" #DocsDest)
                                )


                                (copyfiles
                                        (source #HDWwToolsDest)                                                                         ;Copy `InstallOutlines'
                                        (dest "RAM:")                                                                                                                   ;to RAM for later on
                                        (pattern "InstallOutlines")
                                        (nogauge)
                                        (optional "nofail")
                                )

                                (@AddNewPrinter)
                                (complete 85)
                                (@InstallWwFonts)
                                (complete 90)

        (working "Installing Wordworth 3 - Please wait...")

        ; Lets set the WordworthPrefs file
        (set #PrefsDest (tackon #InsideHDDest "WordworthPrefs"))
        (run
          (cat "RAM:writeprefs3 \"" #PrefsDest "\" \"" #DictDest "\" \"" #ThesDest "\" \"" ChosenDriver "\" \"" TopBord "\" \"" BotBord "\" \"" LeftBord "\" \"" RightBord "\" \"" #TemplatesDest "\""
        ))
      )
    )
  )
)

;More Cleanup
(delete (tackon #RamTempFile ChosenDriver))
(delete #RamTempFile)

(run "resident delete REMOVE")

(delete "RAM:writeprefs3")
(delete "RAM:select")
(delete "RAM:WwPrinterList")

(complete 100)

(if (= #InstallationType "Printer")
        (
    (message #InstallationCompletemsg #DriverUsedmsg1 ChosenDriver #DriverUsedmsg2)
        (exit (quiet))
  )
)

(if (= FloppyFinished 1)
        (
                (if (= #Drivermsg 1)
                        (
                                (exit #FloppyFinishedMsg #DriverUsedmsg1 ChosenDriver #DriverUsedmsg2)
                        )
                        (
                                (exit #FloppyFinishedMsg)
                        )
                )
        )
        (
                (if (= #Drivermsg 1)
                        (
                                (exit #ReBoot #DriverUsedmsg1 ChosenDriver #DriverUsedmsg2)
                        )
                        (
                                (exit #ReBoot)
                        )
                )
        )
)
