.key dest,Flag/k
.bra {
.ket }
.def dest SYS
failat 21
;
; CopyData1
;  FLAGS     FILES
;-----------------------------------------
;  DEMO      .demo files
;
;  LFont     LaserScreenFonts
;
;  LUtil     LaserUtility
;
;  PUtil     LaserUtility
;            Disk1
;            Disk2
;
;  HP        .HP Files in LaserFonts
;            .HP Files in LaserFontsPool
;
;  PS        .PS Files in LaserFonts
;            .PS Files in LaserFontsPool



lab StartData1
If {Flag} EQ "Demo"
   type 'CopyDemo.txt
   ask -dY " Copy Demo Files? Y"
   if warn                   ; no, dont copy Demo Files
      skip END
   endif                      ; yes, Check for Data1 Disk
      skip InsertData1
endif

If {Flag} EQ "LFont"
   type 'CopyLFont.txt
   ask -dY " Copy Amiga Screen Fonts for Laser Printers ? Y"
   if warn                   ; no, dont copy LFont
      skip END
   endif                     ; yes, Check for Data1 Disk
      skip InsertData1
endif

If {Flag} EQ "LUtil"
   type 'CopyLUtil.txt
   ask -dY " Copy Laser Utility ? Y"
   if warn                   ; no, dont copy LUtil
      skip END
   endif                     ; yes, Check for Data1 Disk
      skip InsertData1
endif

If {Flag} EQ "PUtil"
   type 'CopyPUtil.txt
   ask -dY " Copy Laser Utility and Data Files for PostScript Printers ? Y"
   if warn                   ; no, dont copy LUtil and DataFiles
      skip END
   endif                     ; yes, Check for Data1 Disk
      skip InsertData1
endif

If {Flag} EQ "HP"
   type 'CopyHP.txt
   ask -dY " Copy .HP Data Files ? Y"
   if warn                   ; no, dont copy .hp files
      skip END
   endif                     ; yes, Check for Data1 Disk
      skip InsertData1
endif

If {Flag} EQ "PS"
   type 'CopyPS.txt
   ask -dY " Copy .PS Data Files ? Y"
   if warn                   ; no, dont copy .PS files
      skip END
   endif                     ; yes, Check for Data1 Disk
      skip InsertData1
endif


lab InsertData1
   assign >nil: Data1: exists               ; check if they put disk in
   if warn                                ; No Disk, Ask for it
      echo "*N Please insert Data1 Disk and press Return to continue"
      ask  -dy " or type N and Return to cancel and go back to Menu "

         ; if typed "n" then don't copy files, go to END
         ;
         ; if typed "y" or return then check for disk
         ; if disk not found then ask again
         ; if disk is found then skip to CopyDemo

      if  warn                            ; no, don't copy the Files
         skip END
      endif                               ; Yes, do copy Files
         skip InsertData1 BACK            ; go back and check for disk again
   endif

; It seems to me that using
; "IF Flag EQ XXX"
;      do everything for that flag
;  "ENDIF"
; as a way to skip, is less effecient because Execute must keep track of all
; the IF's and ENDIF's to find the correct/matching ENDIF.
;
; It seems like testing the flag and then skiping is much more effecient,
; because altho I use more commands Execute does not have to match ENDIF's
; with IF's and I Skip right to where I want
;
;


If {Flag} EQ "Demo"
   skip Demo
endif

If {Flag} EQ "LFont"
   skip LFont
endif

If {Flag} EQ "LUtil"
   Skip LUtil
endif

If {Flag} EQ "PUtil"
   Skip LUtil
endif

;if it is not any of the above then it must be PS or HP
Skip LPool

lab Demo

;*********************************************
;*                                           *
;*          CopyDemo Files                   *
;*                                           *
;*********************************************

if {dest} eq "SYS"
   echo "*Ec*N Where shall I put the Demo Files?"
   echo "*N -->1) SYS:CityDesk"
   echo "*N    2) SYS:"
   echo "*N    3) I was only joking, I really don't want to copy the Demos"
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?
      if $Choice{$$} EQ 1 VAL
         Skip 3
      endif

      if $Choice{$$} EQ 2 VAL
         Skip 4
      endif

      if $Choice{$$} EQ 3 VAL
         Skip 5
      endif
         FUBAR
else
   echo "*Ec*N Where shall I put the Demo Files?"
   echo "*N -->1) {dest}:CityDesk"
   echo "*N    2) {dest}:"
   echo "*N    3) SYS:CityDesk"
   echo "*N    4) SYS:"
   echo "*N    5) I was only joking, I really don't want to copy the Demos"
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?

lab eval_Choice{$$}
   if $Choice{$$} EQ 1 VAL                ; Copy Demo Files to {dest}:CityDesk
      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
      echo "*NCopying Demo Files to {dest}:CityDesk..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 2 VAL                ; Copy Demo Files to {dest}:
      assign Whereto: {dest}:
      echo "*NCopying Demo Files to {dest}:..." NOLINE
      skip Copy_Files
   Endif

   if $Choice{$$} EQ 3 VAL                ; Copy Demo Files to SYS:CityDesk
   lab 3
      if not exists SYS:CityDesk
         makedir SYS:CityDesk
         copy cdbat:drawer.icon to SYS:CityDesk.info CLONE QUIET
         echo "*NDirectory SYS:CityDesk created" NOLINE
      endif
      assign Whereto: SYS:CityDesk
      echo "*NCopying Demo Files SYS:CityDesk..." NOLINE
      skip Copy_Files
   Endif

   if $Choice{$$} EQ 4 VAL                ; Copy Demo Files to SYS:
   lab 4
      assign Whereto: SYS:
      echo "*NCopying Demo Files to SYS:..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 5 VAL                 ; abort copy
   lab 5
      Echo "*NOk, I won't copy the Demo Files"
      Skip END
   endif

   ; They typed in something other than the 1-3 or 1-5
   lab FUBAR
      if {dest} EQ "SYS"
         echo "*N You must type in a number between 1 and 3"
      else
         echo "*N You must type in a number between 1 and 5"
      endif
         wait 1
         skip Demo BACK

lab Copy_Files
 ;skip debug
   copy Data1:.#?                         to Whereto: CLONE QUIET
 lab Debug
   echo "*N*N Demo Files have been copied"
   skip End


lab LFont

;*********************************************
;*                                           *
;*          CopyLFont Files                  *
;*                                           *
;*********************************************

if {dest} eq "SYS"
   echo "*Ec*N Where shall I put the Screen Fonts for Laser Printers ?"
   echo "*N -->1) FONTS:"
   echo "*N    2) SYS:LFonts"
   echo "*N    3) SYS:CityDesk/LFonts"
   echo "*N    4) Never mind, I was never good at choices anyway."
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?

      if $Choice{$$} EQ 4 VAL
         Skip 6
      endif
      skip Eval_Choice{$$}
else
   echo "*Ec Where shall I put the Screen Fonts for Laser Printers ?"
   echo "*N -->1) FONTS:"
   echo "*N    2) SYS:LFonts"
   echo "*N    3) SYS:CityDesk/LFonts"
   echo "*N    4) {dest}:LFonts"
   echo "*N    5) {dest}:CityDesk/LFonts"
   echo "*N    6) Never mind, I was never good at choices anyway."
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?

lab Eval_Choice{$$}
   if $Choice{$$} EQ 1 VAL                   ; Copy Laser  fonts to fonts:
      assign >nil: fonts: exists             ; Check to make sure that Fonts: is assigned
      if warn
         echo "*NFonts: is not assigned*NPlease pick again"
         skip LFont BACK
      endif
      assign Whereto: fonts:
      echo "*NCopying Laser Printer Fonts to Fonts:..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 2 VAL                   ; Copy Laser  fonts to SYS:Lfonts
      if not exists SYS:LFonts
         makedir SYS:LFonts
         copy cdbat:drawer.icon to SYS:LFonts.info CLONE QUIET
         echo "*NDirectory SYS:LFonts created" NOLINE
      endif
      assign Whereto: sys:LFonts
      echo "*NCopying Laser Printer Fonts to SYS:LFonts..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 3 VAL                   ; Copy Laser  fonts to SYS:CityDesk/Lfonts
      if not exists SYS:CityDesk
         makedir SYS:CityDesk
         copy cdbat:drawer.icon to SYS:CityDesk.info CLONE QUIET
      endif
      if not exists SYS:CityDesk/Lfonts
         makedir SYS:CityDesk/Lfonts
         copy cdbat:drawer.icon to SYS:CityDesk:LFonts.info CLONE QUIET
         echo "*NDirectory SYS:CityDesk/Lfonts created" NOLINE 
      endif
      assign Whereto: SYS:CityDesk/Lfonts
      echo "*NCopying Laser Printer Fonts to SYS:CityDesk/Lfonts..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 4 VAL                   ; Copy Laser  fonts to {dest}:Lfonts
      if not exists {dest}:Lfonts
         makedir {dest}:Lfonts
         copy cdbat:drawer.icon to {dest}:LFonts.info CLONE QUIET
         echo "*NDirectory {dest}:Lfonts created" NOLINE
      endif
      assign Whereto: {dest}:Lfonts
      echo "*NCopying Laser Printer Fonts to {dest}:Lfonts..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 5 VAL                   ; Copy Laser  fonts to {dest}:CityDesk/Lfonts
      if not exists {dest}:CityDesk
         makedir {dest}:CityDesk
         copy cdbat:drawer.icon to {dest}:Fonts.info CLONE QUIET
      endif
      if not exists {dest}:CityDesk/Lfonts
         makedir {dest}:CityDesk/Lfonts
         copy cdbat:drawer.icon to {dest}:CityDesk/LFonts.info CLONE QUIET
         echo "*NDirectory {dest}:CityDesk/Lfonts created" NOLINE
      endif
      assign Whereto: {dest}:CityDesk/Lfonts
      echo "*NCopying Laser Printer Fonts to {dest}:CityDesk/Lfonts..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 6 VAL
   lab 6                                     ; abort copy
      echo "*NOK I wont copy the Screen Fonts for Laser Printers"
      Skip END
   endif

   ; They typed in something other than the 1-4 or 1-6 
      if {dest} EQ "SYS"
         echo "*N You must type in a number between 1 and 4"
      else
         echo "*N You must type in a number between 1 and 6"
      endif
         wait 1
         skip LFont BACK


lab Copy_Files
 ;skip debug
   copy Data1:LFonts                      to WhereTo: ALL CLONE QUIET
 lab Debug
   echo "*N*N All laser fonts have been copied"
skip End


Lab LUtil

;*********************************************
;*                                           *
;*          CopyLUtil Files                  *
;*                                           *
;*********************************************

if {dest} eq "SYS"
   echo "*Ec*N Where shall I put the Laser Utility?"
   echo "*N -->1) SYS:CityDesk"
   echo "*N    2) SYS:"
   echo "*N    3) I was only joking, I really don't want to copy the Laser Utility"
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?
      if $Choice{$$} EQ 1 VAL
         Skip 3
      endif

      if $Choice{$$} EQ 2 VAL
         Skip 4
      endif

      if $Choice{$$} EQ 3 VAL
         Skip 5
      endif
         skip FUBAR
else
   echo "*Ec*N Where shall I put the Laser Utility?"
   echo "*N -->1) {dest}:CityDesk"
   echo "*N    2) {dest}:"
   echo "*N    3) SYS:CityDesk"
   echo "*N    4) SYS:"
   echo "*N    5) I was only joking, I really don't want to copy the Laser Utility"
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?

lab eval_Choice{$$}
   if $Choice{$$} EQ 1 VAL                ; Copy LaserStuff to {dest}:CityDesk
      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     ; WhereTo: used as variable when copying
      setenv Data1{$$} "Assign Data1: {dest}:CityDesk"
      echo "*NCopying Laser Utility to {dest}:CityDesk..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 2 VAL                ; Copy LaserStuff to {dest}:
      assign Whereto: {dest}:             ; WhereTo: used as variable when copying
      setenv Data1{$$} "Assign Data1: {dest}:"
      echo "*NCopying Laser Utility to {dest}:..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 3 VAL                ; Copy LaserStuff to SYS:CityDesk
   lab 3
      if not exists SYS:CityDesk
         makedir SYS:CityDesk
         copy cdbat:drawer.icon to SYS:CityDesk.info CLONE QUIET
      echo "*NDirectory SYS:CityDesk created" NOLINE
      endif
      assign Whereto: SYS:CityDesk        ; WhereTo: used as variable when copying
      setenv Data1{$$} "Assign Data1: SYS:CityDesk"
      echo "*NCopying Laser Utility to SYS:CityDesk..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 4 VAL                ; Copy LaserStuff to SYS:
   lab 4
      assign Whereto: SYS:                ; WhereTo: used as variable when copying
      setenv Data1{$$} "Assign Data1: SYS:"  ; used for adding to SSQ
      echo "*NCopying Laser Utility to SYS:..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 5 VAL
   lab 5                                  ; abort copy
      echo "*NOK I won't copy the Laser Utility"
      Skip END
   endif

   ; They typed in something other than the 1-3 or 1-5
   lab FUBAR
      if {dest} EQ "SYS"
         echo "*N You must type in a number between 1 and 3"
      else
         echo "*N You must type in a number between 1 and 5"
      endif
         wait 1
         skip LUtil BACK

lab Copy_Files
;skip debug
   copy Data1:Laser_Utility               to Whereto: CLONE QUIET
   copy cdbat:LUtil.icon                  to Whereto:Laser_Utility.info CLONE QUIET
   if {Flag} EQ "PUtil"
      copy Data1:Disk1                    to Whereto:Disk1 ALL CLONE QUIET
      copy Data1:Disk2                    to Whereto:Disk2 ALL CLONE QUIET
      copy cdbat:drawer.icon              to Whereto:Disk1.info CLONE QUIET
      copy cdbat:drawer.icon              to Whereto:Disk2.info CLONE QUIET
   endif
lab Debug
   echo  "*N*N Laser Utility has been copied"

lab AddData12CDAssigns
; if they are PostScript, LUtil Needs Data1: assigned to the same directory
; where Disk1 and Disk2 have been copied.
   if {Flag} EQ "PUtil"
      echo "*N*N Adding logical assignments to S:CDAssigns*N"
      echo "*N and Creating CDAssigns icon in {dest}:CityDesk*N"

      if exists s:CDAssigns
         join s:CDAssigns env:Data1{$$} CR   as env:CDAssigns{$$}
         copy env:CDAssigns{$$}              to s:CDAssigns CLONE QUIET
         delete env:CDAssigns{$$}      ; clean up afterwards
      else
         join env:Data1{$$} CR               as s:CDAssigns
      endif

         setenv xyzzy{$$}                 "Execute 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:xyzzy{$$}             ; clean up afterwards
   endif
      delete env:Data1{$$}                ; clean up afterwards
skip End

lab LPool
;*********************************************
;*                                           *
;*          Copy.PSor.HP Files               *
;*                                           *
;*********************************************

if {dest} eq "SYS"
   echo "*Ec*N Where shall I put LaserFonts and LaserFontsPool?"
   echo "*N -->1) SYS:CityDesk"
   echo "*N    2) SYS:"
   echo "*N    3) Never mind, I was never any good at choices anyway"
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?
      if $Choice{$$} EQ 1 VAL
         Skip 3
      endif

      if $Choice{$$} EQ 2 VAL
         Skip 4
      endif

      if $Choice{$$} EQ 3 VAL
         Skip 5
      endif
         skip FUBAR
else
   echo "*Ec*N Where shall I put LaserFonts and LaserFontsPool?"
   echo "*N -->1) {dest}:CityDesk"
   echo "*N    2) {dest}:"
   echo "*N    3) SYS:CityDesk"
   echo "*N    4) SYS:"
   echo "*N    5) Never mind, I was never any good at choices anyway"
   echo "*N Please choose an option by typing its number. Then press Return ?" NOLINE
   setenv >NIL: Choice{$$} ?

lab eval_Choice{$$}
   if $Choice{$$} EQ 1 VAL                ; Copy LaserStuff to {dest}:CityDesk
      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        ; WhereTo: used as variable when copying
      ; The following are used later for Logical Assignments and added to Startup-Sequence
      setenv LaserFonts{$$} "Assign LaserFonts: {dest}:CityDesk/LaserFonts"
      echo "*NCopying LaserFonts and LaserFontsPool to {dest}:CityDesk..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 2 VAL                ; Copy LaserStuff to {dest}:
      assign Whereto: {dest}:                ; WhereTo: used as variable when copying
      echo "*NCopying LaserFonts and LaserFontsPool to {dest}:..." NOLINE
      ; The following are used later for Logical Assignments and added to Startup-Sequence
      setenv LaserFonts{$$} "Assign LaserFonts: {dest}:LaserFonts"
      skip Copy_Files
   endif

   if $Choice{$$} EQ 3 VAL                ; Copy LaserStuff to SYS:CityDesk
   lab 3
      if not exists SYS:CityDesk
         makedir SYS:CityDesk
         copy cdbat:drawer.icon to SYS:CityDesk.info CLONE QUIET
         echo "*NDirectory SYS:CityDesk created" NOLINE
      endif
      assign Whereto: SYS:CityDesk           ; WhereTo: used as variable when copying
      ; The following are used later for Logical Assignments and added to Startup-Sequence
      setenv LaserFonts{$$} "Assign LaserFonts: SYS:CityDesk/LaserFonts"
      echo "*NCopying LaserFonts and LaserFontsPool to SYS:CityDesk..." NOLINE
      skip Copy_Files
   endif

   if $Choice{$$} EQ 4 VAL                ; Copy LaserStuff to SYS:
   lab 4
      assign Whereto: SYS:                   ; WhereTo: used as variable when copying
      echo "*NCopying LaserFonts and LaserFontsPool to SYS:..." NOLINE
      ; The following are used later for Logical Assignments and added to Startup-Sequence
      setenv LaserFonts{$$} "Assign LaserFonts: SYS:LaserFonts"
      skip Copy_Files
   endif

   if $Choice{$$} EQ 5 VAL                ; abort copy
   lab 5
      if {Flag} EQ "PS"
         echo "*NOK I won't copy the .PS Data Files"
      else                                ; must be an HP
         echo "*NOK I won't copy the .HP Data Files"
      endif
      Skip END
   endif

   ; They typed in something other than the 1-3 or 1-5
   lab FUBAR
      if {dest} EQ "SYS"
         echo "*N You must type in a number between 1 and 3"
      else
         echo "*N You must type in a number between 1 and 5"
      endif
         wait 1
         skip LPool BACK


lab Copy_Files
;skip debug
   if {Flag} EQ "PS"
      copy Data1:LaserFonts/#?.ps#?       to Whereto:LaserFonts ALL CLONE QUIET
      makedir WhereTo:LaserFontsPool      ; make it for them
   else    ; Must be {Flag} = HP
      copy Data1:LaserFonts/#?.hp#?       to Whereto:LaserFonts ALL CLONE QUIET
      copy Data1:LaserFontsPool/#?.hp#?   to Whereto:LaserFontsPool ALL CLONE QUIET
   endif
      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 LaserFonts and LaserFontsPool have been copied"

lab AddLaserFonts2CDAssigns
; They have copied .PS or .HP files, City Desk 2.0 needs LaserFonts:
; assigned to where the LaserFonts drawer has been placed
      echo "*N*N Adding logical assignments to S:CDAssigns*N"
      echo "*N and Creating CDAssigns icon in {dest}:CityDesk*N"

      if exists s:CDAssigns
         join s:CDAssigns env:laserFonts{$$} CR as env:CDAssigns{$$}
         copy env:CDAssigns{$$}           to s:CDAssigns CLONE QUIET
         delete env:CDAssigns{$$}         ; clean up afterwards
      else
         join env:laserFonts{$$} CR       as S:CDAssigns
      endif

         setenv xyzzy{$$}                 "Execute S:CDAssigns"
         join env:xyzzy{$$} CR            as whereto:CDAssigns
         copy CDBAT:CDAssigns.icon        to whereto:CDAssigns.info CLONE QUIET

         delete env:xyzzy{$$}             ; clean up afterwards
         delete env:laserFonts{$$}        ; clean up afterwards
skip End


lab End
   Echo "*NPlease wait for Menu..." NOLINE
