home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 20 / af020.adf / Beginners / installprinter < prev    next >
AmigaDOS Script File  |  1980-02-24  |  4KB  |  143 lines

  1. .key number
  2. .bra {
  3. .ket }
  4. .def number 0
  5.  
  6. ; This recursive script comes courtesy of Mastering AmigaDOS scripts
  7. ; another great volume in the Mastering AmigaDOS series
  8. ; Mastering AmigaDOS scripts will be published in mid 1991
  9. ; by Bruce Smith Books
  10. ; This trinket written by Mark Smiddy"
  11. ; for Amiga Format readers
  12.  
  13. ; THIS VERSION REPLACES THE ONE ON AFT 19 WHICH NEEDS 1MEG TO RUN
  14. ; SORRY ABOUT THAT!
  15.  
  16. ; IT MUST HAVE THE NAME OF INSTALLPRINTER
  17.  
  18. if "{number}" EQ "0"
  19.  echo "Easy Printer Driver setup - V1.2*n"
  20.  echo "Written by *e[33mMark Smiddy*e[31m for *e[33mAmiga Format*e[31m"
  21.  echo "From Mastering AmigaDOS scripts"
  22.  echo "Another volume in the Mastering AmigaDOS 2 series"
  23.  echo "The most informed AmigaDOS reference EVER!*n*n"
  24.  
  25.  if not exists t:Smiddy
  26.   echo "Wait - copying commands to resident list...*n*n*n"
  27.   resident c:echo add
  28.   resident c:if add
  29.   resident c:else add
  30.   resident c:endif add
  31.   resident c:copy add
  32.   resident c:delete add
  33.   resident c:join add
  34.   resident c:edit add
  35.   resident c:assign add
  36.   resident c:execute add
  37.   resident c:type add
  38.   resident c:list add
  39.   resident c:ask add
  40.   resident c:search add
  41.   resident c:makedir add
  42.   copy installprinter t:
  43.   echo >t:Smiddy "Working..."
  44.  endif
  45.  
  46.  if not exists t:drivers
  47.   makedir t:drivers
  48.   echo "*nInsert the disk marked *"Extras 1.3*" in df0:"
  49.   ask "Then press return..."
  50.  endif
  51.  
  52.  list df0:devs/printers lformat "%s" to t:print
  53.  list df0:devs/printers lformat "       COPY from *"%s%s*" to t:drivers quiet" to t:copyprint
  54.  type >t:printers t:print opt n
  55.  type t:printers
  56.  echo "*nSelect your printer and enter its " noline
  57.  execute t:InstallPrinter ?
  58.  echo "*nInsert the disk marked *"Workbench 1.3*" in df0:"
  59.  ask "Then press return..."
  60.  if exists t:Command1
  61.  execute t:Command1
  62. ;
  63. ; This next bit runs Preferences for you
  64. ; BUT it allows you to modify the preferences on ANY disk!
  65. ; This way you can have more than one printer disk... etc.
  66. ;
  67.  ask "*nRun Preferences now?"
  68.   if warn
  69.    assign devs: df0:devs
  70.    if exists df0:Prefs/Preferences
  71.      df0:Prefs/Preferences PRINTER
  72.    else
  73.     echo "Preferences program missing/renamed"
  74.     ask "Shall I try the boot disk?"
  75.     if warn
  76.      if exists sys:Prefs/Preferences
  77.       sys:Prefs/Preferences PRINTER
  78.      else
  79.      echo "Blow me! That one's missing 'n all guv!"
  80.      endif
  81.     endif
  82.    endif
  83.    assign devs: sys:devs
  84.  endif
  85.  echo "All done... cleaning up"
  86.  endif
  87.  
  88.  if "{number}" NOT EQ ""
  89.   delete >nil: t:#? all QUIET
  90.   resident echo remove
  91.   resident assign remove
  92.   resident if remove
  93.   resident endif remove
  94.   resident copy remove
  95.   resident type remove
  96.   resident execute remove
  97.   resident join remove
  98.   resident edit remove
  99.   resident list remove
  100.   resident ask remove
  101.   resident else remove
  102.   resident search remove
  103.   resident makedir remove
  104.   resident delete remove
  105.  endif
  106. endcli
  107. else
  108.  
  109.  
  110. ;
  111. ; Here we use the auto EDIT macros!
  112. ; This is covered with loads of examples in
  113. ; Mastering AmigaDOS volumes I and II
  114. ; This is pretty complex stuff- but it does work!
  115.  
  116.  
  117.  search >nil: t:printers search " {number} "
  118.  if warn
  119.   echo "Can't find that printer on my list..."
  120.   echo "Program exiting"
  121.   endcli
  122.  else
  123.   echo >t:auto1 "{number}d;7#;n;0d"
  124.   echo >t:auto2 "cl//"
  125.   echo >t:part0 ""
  126.   echo >t:part1 "COPY from t:drivers/" noline
  127.   echo >t:part3 " to df0:devs/printers" noline
  128.   echo >>t:printers ""
  129.   echo >>t:copyprint ""
  130.   join t:part0 t:printers as t:printx
  131.   edit from t:printx to t:part2 with t:auto1 ver=nil:
  132.   join t:part1 t:part2 t:part3 as t:command
  133.   edit t:command to t:command1 with t:auto2 ver=nil:
  134.   echo "*n Your selection was: " noline
  135.   type t:part2
  136.   join t:part0 t:copyprint as t:copyx
  137.   edit t:copyx to t:command3 with t:auto1 ver=nil:
  138.   execute t:command3
  139.   echo " (That noise was just me copying the driver to RAM:)"
  140.  endif
  141. endif
  142.  
  143.