.key dest,Printer/k,Laser/k
.bra {
.ket }
.def dest SYS
failat 21
;
; CopyData2.bat
;

;
; Flags
;
; Printer   
;  24   =   24 pin printer
;   9   =    9 pin printer
;  HP   =   HP LaserJet PLUS or Compatible
;  PS   =   PostScript Printer
;
; Laser     
;  Y    =   Yes, it is a Laser Printer
;  N    =   No, its not a Laser Printer
;


lab Start


; Check for CityDesk dir on {dest},
; if it does not exist, create it and copy Drawer icon
; Then assign Whereto: to {dest}:CityDesk
; I use Whereto: to tell me where to put most files
;
if not exists {dest}:CityDesk
   makedir {dest}:CityDesk
   copy cdbat:drawer.icon to {dest}:CityDesk.info CLONE QUIET
   echo "*NDirectory {dest}:CityDesk created" NOLINE 
endif
   assign whereto: {dest}:CityDesk
   

; CityDesk_2.0 disk is where City Desk 2.0 and Hyphenation routines reside
; we will ask for the disk then copy these files to {dest}:CityDesk
lab InsertCityDesk_2.0
   assign >nil: CityDesk_2.0: exists      ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N*N I need the disk CityDesk_2.0*N so I can Copy City Desk 2.0 to {dest}:CityDesk"
      echo "*N Please insert CityDesk_2.0 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go to next step "
      if  warn                            ; no, don't copy City Desk 2.0
         skip InsertData1                 ;
      else                                ; Yes, do copy City Desk 2.0
         skip InsertCityDesk_2.0 BACK     ; go back and check for disk again
      endif
   else                                   ; CityDesk_2.0 Disk is available
      echo "*N*NCopying City Desk 2.0 to {dest}:CityDesk..." NOLINE
    ;skip debug
      copy CityDesk_2.0:(Ci#?|Hy#?)       to Whereto: CLONE QUIET
      copy CDBAT:CD.icon                  to Whereto:CityDesk_2.0.info CLONE QUIET
    lab Debug
      echo "*N*N City Desk 2.0 has been copied to {dest}:CityDesk" NOLINE
   endif


; We know we need Demo files so lets get data1:
lab InsertData1
   assign >nil: Data1: exists             ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N*N I need the disk Data1: so I can copy the Demo Files "
      echo "*N Please insert Data1 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go to next step "
      if  warn                            ; no, don't copy the Demo Files
         skip CheckPrinter
      else                                ; Yes, do copy Demo Files
         skip InsertData1 BACK            ; go back and check for disk again
      endif
   else                                   ; Data1: Disk is available
         echo "*N*NCopying Demo Files to {dest}:CityDesk..." NOLINE
       ;skip debug
         copy Data1:.#?                   to Whereto: CLONE QUIET
       lab Debug
         echo "*N*N All Demo files have been copied to {dest}:CityDesk" NOLINE
   endif

   ; Check to see if we need LaserStuff
;      Laser_Utility         (in whereto:)
;      Laser Screen Fonts    (in Lfonts)
;      PostScript Data files (in Disk1 and Disk2)
;      HP LaserJet .hp files (in Laserfonts and LaserFontsPool)
;      PostScript .ps files  (in Laserfonts and LaserFontsPool)
lab CheckPrinter
   IF {Laser} EQ "N"                      ;if 9 or 24 pin printer skip Next Step
      If {Printer} EQ "9"
         Skip InsertData3
      else
         Skip InsertData2
      endif
   endif

; Data1: is where all the Laser Screen Fonts are lets copy them to Fonts:
lab InsertData1
   assign >nil: Data1: exists             ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N*N I need the disk Data1: so I can copy"
      echo " the Amiga screen fonts for laser printers*N and the laser printer support files "
      echo "*N Please insert Data1 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go to next step "
      if  warn                            ; no, don't copy the Files
         skip InsertData2
      else                                ; Yes, do copy Files
         skip InsertData1 BACK            ; go back and check for disk again
      endif
   endif                                  ; Data1: Disk is available

      ; Copy Amiga Screen Fonts for Laser Printers
      assign >nil: fonts: exists          ; Check to make sure that Fonts: is assigned
      if NOT warn
         echo "*N*NCopying Laser Printer Fonts to Fonts:..." NOLINE
       ;skip debug
         copy Data1:LFonts                to Fonts: ALL CLONE QUIET
       lab debug
         echo "*N*N All laser fonts have been copied" NOLINE
      else
         echo "*N*NFonts: is not assigned"
         echo "I can't copy Laser printer fonts to FONTS:" NOLINE
      endif

      ; Copy Laser Printer Support files.
      ;skip debug
      If {Printer} EQ "PS"                   ; this is a PostScript Printer
         echo "*N*NCopying PostScript Printer Support Files to {dest}:CityDesk..." NOLINE
         copy Data1:Disk1/#?                 to Whereto:Disk1 CLONE QUIET
         copy Data1:Disk2/#?                 to Whereto:Disk2 CLONE QUIET
         copy cdbat:drawer.icon              to Whereto:Disk1.info CLONE QUIET
         copy cdbat:drawer.icon              to Whereto:Disk2.info CLONE QUIET
         copy Data1:LaserFonts/#?.ps#?       to Whereto:LaserFonts CLONE QUIET
         makedir WhereTo:LaserFontsPool      ; make it for them
      else                                   ; It must be a HP LaserJet Printer
         echo "*N*NCopying HP LaserJet Printer Support Files to {dest}:CityDesk..." NOLINE
         copy Data1:LaserFonts/#?.hp#?       to Whereto:LaserFonts CLONE QUIET
         copy Data1:LaserFontsPool/#?.hp#?   to Whereto:LaserFontsPool CLONE QUIET
      endif         
         copy Data1:Laser#?                  to Whereto: CLONE QUIET
         copy cdbat:LUtil.icon               to Whereto:Laser_Utility.info CLONE QUIET
         copy cdbat:drawer.icon              to Whereto:LaserFonts.info CLONE QUIET
         copy cdbat:drawer.icon              to Whereto:LaserFontsPool.info CLONE QUIET

      lab Debug
         echo "*N*N All Laser Printer support files have been copied to {dest}:CityDesk" NOLINE

lab MakeCDAssigns
; makes s:CDAssigns with correct logical assignments
; also creates  CDAssigns Icon in {dest}:CityDesk

      echo "*N*N Adding logical assignments to S:CDAssigns"
      echo "*N and Creating CDAssigns icon in {dest}:CityDesk*N"

      setenv xyzzy{$$}      "Execute S:CDAssigns"
      setenv Data1{$$}      "Assign Data1:       {dest}:CityDesk"
      setenv laserfonts{$$} "Assign LaserFonts:  {dest}:CityDesk/LaserFonts"

      join env:Data1{$$} CR env:laserfonts{$$} CR  as S:CDAssigns
      join env:xyzzy{$$} CR                        as whereto:CDAssigns

      copy CDBAT:CDAssigns.icon        to whereto:CDAssigns.info CLONE QUIET
      copy CDBAT:IconX                 to whereto: CLONE QUIET

      delete env:Data1{$$}             ; clean up afterwards
      delete env:xyzzy{$$}             ; clean up afterwards
      delete env:laserfonts{$$}        ; clean up afterwards

; Data2: is where the 24 pin Printer fonts are
; So lets get them and copy them to FONTS:

lab InsertData2
If {Printer} EQ "24"
   assign >nil: Data2: exists             ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N*N I need the Data2: disk so I can*N copy fonts for 24 pin printers"
      echo "*N Please insert Data2 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go to next step "
      if  warn                            ; no, don't copy the files
         skip InsertData3
      else                                ; Yes, do copy Data2
         skip InsertData2 BACK            ; go back and check for disk again
      endif
   else                                   ; Disk is available
      assign >nil: fonts: exists          ; Check to make sure that Fonts: is assigned
      if warn
         echo "*N*NFonts: is not assigned!!!"
         echo "I can't copy 24 pin printer fonts to FONTS:*N*N"
         wait 
         skip InsertData3
      endif
      echo "*N*NCopying 24 pin printer fonts to Fonts:..." NOLINE
    ;skip debug
      copy Data2:24pinFonts               to FONTS: ALL CLONE QUIET
    lab Debug
      echo "*N*N All 24 pin printer fonts have been copied to FONTS:" NOLINE
   endif
endif


; We know we want Du5 so get Data3:
lab InsertData3
   assign >nil: Data3: exists             ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N*N I need the disk Data3: in order to copy Du5"
      echo "*N Please insert Data3 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go to next step "
      if  warn                            ; no, don't copy Du5
         skip InsertData3
      else                                ; Yes, do copy DU5
         skip InsertData3 BACK            ; go back and check for disk again
      endif
   else                                   ; Data3 Disk is available
      echo "*N*NCopying the Du5 to {dest}:CityDesk..." NOLINE
    ;skip debug
      Copy Data3:DirUtil5                 to Whereto: CLONE QUIET
      Copy Data3:Du5                      to Whereto: CLONE QUIET
      Copy cdbat:Du5.icon                 to Whereto:DU5.info CLONE QUIET
      Copy CDBAt:IconX                    to Whereto: CLONE QUIET
    lab Debug
      echo  "*N*N Du5 has been copied to {dest}:CityDesk" NOLINE
   endif


; Copy HP_SoftFonts if this is a laser printer
lab InsertData3
If {printer} EQ "HP"
   assign >nil: Data3: exists             ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N*N I need the disk Data3: in order to copy HP_SoftFonts"
      echo "*N Please insert Data3 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go to next step "
      if  warn                            ; no, don't copy HPSoftFont
         skip END
      else                                ; Yes, do copy HPSoftFont
         skip InsertData3 BACK            ; go back and check for disk again
      endif
   else                                   ; Data3 Disk is available
      echo "*N*NCopying the HP LaserJet SoftFont files to {dest}:CityDesk..." NOLINE
    ;skip debug
      Copy Data3:HP_SoftFonts/#?          to Whereto:HP_SoftFonts ALL CLONE QUIET
      Copy cdbat:drawer.icon              to Whereto:HP_SoftFonts.info CLONE QUIET
    lab Debug
      echo  "*N*N All the HP LaserJet SoftFont files have been copied to {Dest}:CityDesk" NOLINE
   endif
endif

lab END
   Echo "*N*N*N Ok, I have copied all the files for your printer*N to where I think they belong*N*N Please wait for Main Menu..." NOLINE
;   ask -dY "Press Return to continue..." ; used to debug
