home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / fntviw.zip / Install.Cmd < prev    next >
OS/2 REXX Batch file  |  1995-04-29  |  5KB  |  223 lines

  1. /* Install.CMD: Install Sheppard Software Utilities. */
  2.  
  3. '@Echo Off'
  4.  
  5. /* Initialize object title and program name(s) */
  6.  
  7. Title = 'FontView Version 1.1'
  8. Pgmname.0 = 1
  9. Pgmname.1 = 'FontView'
  10.  
  11. IconName.0 = 1
  12. IconName.1 = 'FontView'
  13.  
  14. /* Load REXXUTIL */
  15.  
  16. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  17. Call SysLoadFuncs
  18.  
  19.  
  20. /* Initialize */
  21.  
  22. Signal On Failure Name FAILURE
  23. Signal On Halt Name HALT
  24. Signal On Syntax Name SYNTAX
  25.  
  26. Call SysCls
  27. Say 'Installing ' Title
  28. Say ''
  29.  
  30.  
  31. /* Verify the existence of the component files. */
  32.  
  33.  
  34. Result = SysFileTree( Pgmname.1".Exe", 'Files', 'F' )
  35. If Files.0 = 0 Then
  36.    Do
  37.    Say 'ERROR:' Pgmname.1'.Exe not found!'
  38.    Signal DONE
  39.    End
  40.  
  41. Result = SysFileTree( Pgmname.1".Ico", 'Files', 'F' )
  42. If Files.0 = 0 Then
  43.    Do
  44.    Say 'ERROR:' Pgmname.1'.Ico not found!'
  45.    Signal DONE
  46.    End
  47.  
  48. Result = SysFileTree( Pgmname.1".Txt", 'Files', 'F' )
  49. If Files.0 = 0 Then
  50.    Do
  51.    Say 'ERROR:' Pgmname.1'.Txt not found!'
  52.    Signal DONE
  53.    End
  54.  
  55. Result = SysFileTree( "Register.Txt", 'Files', 'F' )
  56. If Files.0 = 0 Then
  57.    Do
  58.    Say 'ERROR: Register.Txt not found!'
  59.    Signal DONE
  60.    End
  61.  
  62. Result = SysFileTree( "Read.Me", 'Files', 'F' )
  63. If Files.0 = 0 Then
  64.    Do
  65.    Say 'ERROR: Read.Me not found!'
  66.    Signal DONE
  67.    End
  68.  
  69. Result = SysFileTree( "File_ID.Diz", 'Files', 'F' )
  70. If Files.0 = 0 Then
  71.    Do
  72.    Say 'ERROR: File_ID.Diz not found!'
  73.    Signal DONE
  74.    End
  75.  
  76. Result = SysFileTree( "UtilPack.Ico", 'Files', 'F' )
  77. If Files.0 = 0 Then
  78.    Do
  79.    Say 'ERROR: UtilPack.Ico not found!'
  80.    Signal DONE
  81.    End
  82.  
  83. /* Find out where we are. */
  84.  
  85. curdir = directory()
  86.  
  87. /* Ask for the target directory name. */
  88.  
  89. Say 'Please enter the full name of the directory in which'
  90. Say '  you want' Title' installed (default: 'curdir'): '
  91. Pull InstDir
  92. If InstDir = "" Then
  93.   InstDir = curdir
  94.  
  95.  
  96. /* Create the target directory if necessary. */
  97.  
  98. Result = SysFileTree(InstDir, 'Dirs', 'D')
  99. If Dirs.0 = 0 Then
  100.   Do
  101.     Result = SysMkDir(InstDir)
  102.     If Result == 0 Then
  103.       Do
  104.       End
  105.     Else
  106.       Do
  107.         Say 'ERROR: Unable to create target directory.'
  108.         Signal DONE
  109.       End
  110.   End
  111. Say ''
  112.  
  113.  
  114. /* Perform the installation. */
  115.  
  116. if InstDir <> curdir then
  117.   Do
  118.     i = 1
  119.     Do until i > Pgmname.0
  120.       Say 'Copying' Pgmname.i 'to' InstDir '...'
  121.       Copy Pgmname.i".Exe" InstDir  '>NUL'
  122.       Copy Pgmname.i".Ico" InstDir  '>NUL'
  123.       Copy Pgmname.i".Txt" InstDir  '>NUL'
  124.       i = i + 1
  125.     End
  126.     Copy Register.Txt InstDir  '>NUL'
  127.     Copy Read.Me      InstDir  '>NUL'
  128.     Copy File_ID.Diz  InstDir  '>NUL'
  129.     Copy Install.Cmd  InstDir  '>NUL'
  130.     Copy UtilPack.Ico InstDir  '>NUL'
  131.   End
  132. Say 'Creating program folder...'
  133. x = SysCreateObject("WPFolder",,
  134.                     "Sheppard^Utilities",,
  135.                     "<WP_DESKTOP>",,
  136.                     "OBJECTID=<SSCUtil>;ICONFILE="||InstDir||"\UtilPack.Ico",,
  137.                     "Update")
  138. If x <> 1 Then
  139.   Do 
  140.     Say 'ERROR: Folder not created.'
  141.     Signal DONE
  142.   End
  143. i = 1
  144. Folder = '<SSCUtil>'
  145. Do until i > Pgmname.0
  146.   Say 'Creating program object for' IconName.i '...'
  147.   Type = 'WPProgram'
  148.   Parms = "EXENAME="InstDir"\"Pgmname.i".Exe;STARTUPDIR="InstDir
  149.   If Pgmname.i = 'BMPView' then
  150.     Parms = Parms";PARAMETERS=[]"
  151.   If Pgmname.i = 'Compare' then
  152.     Parms = Parms";PARAMETERS=[Enter file names]"
  153.   If Pgmname.i = 'FontView' then
  154.     Parms = Parms";PARAMETERS=[Enter size.Fontname]"
  155.   x = SysCreateObject(Type,,
  156.                       IconName.i,,
  157.                       Folder,,
  158.                       Parms,,
  159.                       "Replace")
  160.   If x <> 1 Then
  161.     Do
  162.       Say 'ERROR: Object not created.'
  163.       Signal DONE
  164.     End
  165.  
  166.   Say 'Creating documentation object for' IconName.i '...'
  167.   Type = 'WPShadow'
  168.   Parms = "SHADOWID="InstDir"\"Pgmname.i".Txt"
  169.   x = SysCreateObject(Type,,
  170.                       Pgmname.i||".Txt",,
  171.                       Folder,,
  172.                       Parms,,
  173.                       "Replace")
  174.   If x <> 1 Then
  175.     Say 'ERROR: Shadow of' Pgmname.i'.Txt not created.'
  176.   i = i + 1
  177. End
  178.  
  179. Say 'Creating Register.Txt object...'
  180. x = SysCreateObject("WPShadow",,
  181.                     "Register.Txt",,
  182.                     Folder,,
  183.                     "SHADOWID="||InstDir||"\Register.Txt",,
  184.                     "Replace")
  185. If x <> 1 Then
  186.   Say 'ERROR: Shadow of Register.Txt not created.'
  187.  
  188. Say 'Creating Read.Me object...'
  189. x = SysCreateObject("WPShadow",,
  190.                     "Read.Me",,
  191.                     Folder,,
  192.                     "SHADOWID="||InstDir||"\Read.Me",,
  193.                     "Replace")
  194. If x <> 1 Then
  195.   Say 'ERROR: Shadow of Read.Me not created.'
  196.  
  197. Say 'Creating File_ID.Diz object...'
  198. x = SysCreateObject("WPShadow",,
  199.                     "File_ID.Diz",,
  200.                     Folder,,
  201.                     "SHADOWID="||InstDir||"\File_ID.Diz",,
  202.                     "Replace")
  203. If x <> 1 Then
  204.   Say 'ERROR: Shadow of File_ID.Diz not created.'
  205.  
  206. say 'Install completed.'
  207. Signal DONE
  208.  
  209. FAILURE:
  210. Say 'REXX failure.'
  211. Signal DONE
  212.  
  213. HALT:
  214. Say 'REXX halt.'
  215. Signal DONE
  216.  
  217. SYNTAX:
  218. Say 'REXX syntax error.'
  219. Signal DONE
  220.  
  221. DONE:
  222. Exit
  223.