home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / print / prt2up / install.cmd next >
OS/2 REXX Batch file  |  1993-04-15  |  8KB  |  192 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  Install Prt2Up                                                         *
  4.  *                                                                         *
  5.  *  This REXX script installs the Prt2Up program in a directory            *
  6.  *  of your choice and creates a program reference object on the           *
  7.  *  desktop.                                                               *
  8.  *                                                                         *
  9.  *  After installation has been completed, you may move the                *
  10.  *  program reference object to any workplace shell folder.                *
  11.  *                                                                         *
  12.  *  Prt2Up (c) Copyright 1993 Software Architects, Inc.                    *
  13.  *                                                                         *
  14.  *  First published in PC Magazine, US Edition, August 1993                *
  15.  *                                                                         *
  16.  ***************************************************************************/
  17.  
  18. /***************************************************************************
  19.  *  Load RexxUtil interface                                                *
  20.  ***************************************************************************/
  21.  
  22. Call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  23. Call SysLoadFuncs;
  24.  
  25. call SysCls                         /* Clear the screen */
  26.  
  27.  
  28. call signon
  29. call getdir
  30. call copyfiles
  31. call createobj
  32. call signoff
  33. exit
  34.  
  35.  
  36. /***************************************************************************
  37.  *                                                                         *
  38.  *  signon: Tell the user what's happening and ask if he/she wants to      *
  39.  *          continue with installation process.                            *
  40.  *                                                                         *
  41.  ***************************************************************************/
  42.  
  43. signon: procedure
  44.  
  45. say " "
  46. say "   ╔════════════════════════════════════════════════════════════════════════╗"
  47. say "   ║                                                                        ║"
  48. say "   ║                    Install Prt2Up n-Up Print Utility                   ║"
  49. say "   ║                                                                        ║"
  50. say "   ║   This program will install Prt2Up in a directory of your choice and   ║"
  51. say "   ║   create a Prt2Up object on your desktop.                              ║"
  52. say "   ║                                                                        ║"
  53. say "   ║   Press 'C' to cancel installation or any key to continue.             ║"
  54. say "   ║                                                                        ║"
  55. say "   ╚════════════════════════════════════════════════════════════════════════╝"
  56. say " "
  57.  
  58. pull response .
  59.  
  60. if response = 'C' then do
  61.     say 'Installation of Prt2Up cancelled at your request.'
  62.     exit
  63. end
  64.  
  65. return      /* User wants to continue installation */
  66.  
  67.  
  68. /***************************************************************************
  69.  *                                                                         *
  70.  *  getdir: Ask the user for the directory in which Prt2Up is to be        *
  71.  *          installed.  Create the directory if needed, or ask if an       *
  72.  *          existing directory should be used.                             *
  73.  *                                                                         *
  74.  ***************************************************************************/
  75.  
  76. getdir: procedure expose targetdir
  77.  
  78. getdirretry:
  79.  
  80. say " "
  81. say "Enter the drive and directory in your PATH that Prt2Up should be"
  82. say "installed in or press enter to install in C:\PRT2UP"
  83.  
  84. pull targetdir
  85.  
  86. if targetdir = " " then do
  87.     targetdir = "C:\Prt2Up"             /* Set default if user didn't enter */
  88. end
  89.  
  90. rk = SysMkDir(targetdir)               /* Try to create the directory */
  91.  
  92. if rk = 0 then return                   /* If successful, we have a directory */
  93.  
  94. if rk = 5 then do
  95.     say " "
  96.     say "Directory " targetdir " already exists."
  97.     say "Press Y to use this directory.  Press any other key to enter"
  98.     say "a new directory name."
  99.  
  100.     pull response .
  101.     if response = 'Y' then return
  102.                       else signal getdirretry
  103.  
  104. end
  105.  
  106. if rk = 3 then do
  107.     say " "
  108.     say "This installation program can create only one additional level"
  109.     say "in the directory tree.  It appears you may have asked for"
  110.     say "additional levels to be created."
  111.     say " "
  112.     say "Press any key to re-enter the directory name."
  113.  
  114.     pull response .
  115.     signal getdirretry
  116.  
  117. end
  118.  
  119. say "An error occurred while trying to make the directory: " targetdir
  120. say " "
  121. say "Prt2Up installation is unable to complete and is terminating now."
  122. say " "
  123. say "Please see READ.ME file to learn how to install Prt2Up manually."
  124. say " "
  125.  
  126. exit
  127.  
  128. /***************************************************************************
  129.  *                                                                         *
  130.  *  copyfiles: Copy all Prt2Up files to the target directory               *
  131.  *                                                                         *
  132.  ***************************************************************************/
  133. copyfiles: procedure expose targetdir
  134.  
  135. 'copy prt2.cmd' targetdir
  136. 'copy prt2up.*' targetdir
  137.  
  138. if rc = 0 then return
  139.  
  140. say " "
  141. say "***** An error occurred copying Prt2Up to" targetdir
  142. say "      Installation of Prt2Up is unable to complete and is terminating"
  143. say "      now."
  144. say " "
  145. exit
  146.  
  147.  
  148. /***************************************************************************
  149.  *                                                                         *
  150.  *  createobj: Create the program reference object for Prt2Up              *
  151.  *                                                                         *
  152.  ***************************************************************************/
  153.  
  154. createobj: procedure expose targetdir
  155.  
  156. say 'Creating Prt2Up object on desktop ...'
  157.  
  158. rk = SysCreateObject( "WPProgram", "Prt2Up", "<WP_DESKTOP>", "OBJECTID=<Prt2Up>;EXENAME="targetdir"\prt2up.exe")
  159.  
  160. if rk = 0 then do
  161.     say " "
  162.     say "***** Install was unable to create a Prt2Up object on your desktop."
  163.     say "      Please see READ.ME file for directions on how to create a"
  164.     say "      a Prt2Up program object manually."
  165.     say " "
  166.     say "      Files have been copied to " targetdir " but Prt2Up object"
  167.     say "      on desktop has not been created."
  168.     say " "
  169.     say '      Press Enter key to terminate installation.'
  170.  
  171.     pull response .
  172.     exit
  173. end
  174.  
  175. return
  176.  
  177. /***************************************************************************
  178.  *                                                                         *
  179.  *  signoff: Tell the user installation has been completed successfully    *
  180.  *                                                                         *
  181.  ***************************************************************************/
  182.  
  183. signoff: procedure
  184.  
  185. say ' '
  186. say 'Installation of Prt2Up has completed successfully.'
  187. say 'Press Enter key now.'
  188.  
  189. pull response .
  190. exit
  191.  
  192.