home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / dhc_200.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1998-03-30  |  4KB  |  139 lines

  1. /* REXX file to install DH_ClipSave/2 on the deskop     */
  2. /* if you use this script as a starting point for your   */
  3. /* own install script and make improvements, please send */
  4. /* me a copy ---  dwhawk@southwind.net                   */
  5.  
  6. call rxfuncadd 'sysloadfuncs', 'rexxutil', 'sysloadfuncs'
  7. call sysloadfuncs                /* register system functions */
  8. address cmd '@echo off'          /* echo is turned off */
  9.  
  10. call SysCLS
  11.  
  12. version = 'S'
  13. savefile='clipsave'
  14. me='DH_ClipSave/2'
  15. object_name=me;
  16. say "DH_ClipSave/2 installation"
  17. say "Enter destination drive and directory"
  18. say "for example C:\OS2\APPS"
  19. say "to install in the curent directory just press enter"
  20.  
  21. parse pull dest
  22. call setup_dir(dest) 
  23. say " "
  24.  
  25. call SysFileTree 'clipsave.exe', 'file', 'F'
  26.  
  27. if file.0 = '0' then do
  28.    say "Enter CPU version to install"
  29.    say "Enter 3 for 386 version"
  30.    say "Enter 4 for 486 version"
  31.    say "Enter 5 for 586/686/Pentium version"
  32.    parse pull version
  33.    say "You have entered a "version
  34.    Call Check_Ok  /* your check routine */
  35.    say "Enter file name for saved text"
  36.    parse pull savefile
  37.    say "You have entered "savefile" for the file name"
  38.    Call Check_Ok  /* your check routine */
  39.  
  40.    say "Enter the program object name"
  41.    say "To use DH_ClipSave/2 , just press enter"
  42.  
  43.    parse pull oname
  44.    object_name=oname
  45.    If object_name= "" Then object_name = me
  46.  
  47.    say "You have entered "object_name" for the program object name"
  48.    Call Check_Ok  /* your check routine */
  49.    end
  50. else 
  51.   say "Installing shareware version of DH_ClipSave/2"
  52.  
  53. call copy_files
  54. call MKOBJ
  55. exit
  56.  
  57. check_ok:
  58.   say  'Okay to continue(Y/N) ? '        
  59.   k = SysGetKey('NOECHO') 
  60.   if k = 'Y' | k = 'y'  then return
  61.   say 'halting'
  62.     exit
  63.  
  64.  
  65. mkdir:  /* Procedure for creating dir */
  66.   Parse Arg dir
  67.   rc = SysMkDir(dir)
  68.   If (rc = 0 | rc = 5) Then Return
  69.   Say 'Problem creating destination directory "'dir'"'
  70.   Exit
  71.  
  72.  
  73. MKOBJ:
  74.    if version = "5" then do
  75.       Settings = 'EXENAME='direct||'\clipsav5.exe;'
  76.    end     
  77.    if version = "4" then do
  78.       Settings = 'EXENAME='direct||'\clipsav4.exe;'
  79.    end     
  80.    if version = "3" then do
  81.       Settings = 'EXENAME='direct||'\clipsav3.exe;'
  82.    end     
  83.    if version = "S" then do
  84.       Settings = 'EXENAME='direct||'\clipsave.exe;'
  85.    end     
  86.  
  87. Settings = Settings||'PROGTYPE=PM;MINIMIZED=YES'
  88. Settings = Settings||'ICONFILE=clipsave.ico;'
  89. Settings = Settings||'CCVIEW=NO;'
  90. Settings = Settings||'STARTUPDIR='||direct';'
  91. Settings = Settings||'PARAMETERS='savefile';'
  92. rc=SysCreateObject('WPProgram',object_name,'<WP_DESKTOP>',Settings,'R');
  93.  
  94. if rc = 1 then Say "DH_ClipSave/2 installed on desktop"
  95. return
  96.  
  97. setup_dir:      /* accept install path and create it if needed */
  98.                 /* the desired install path is in ARG(1) */
  99.                 /* if no path is specified current directory is used*/
  100.  
  101. Parse Arg destin  /* parameter of setup_dir */
  102.  
  103. save_dest = destin    /*  save original destin to */
  104.                       /*  determine if copy needed */
  105.  
  106. If destin = "" Then destin = Directory()
  107.  
  108. Say "Shall I install in "destin" ?"
  109. Call Check_Ok  /* your check routine */
  110.  
  111. Parse Var destin direct ':\' destin   /* get drive name only */
  112. direct=direct':'
  113.  
  114. Do Until destin = ""     /* No matter how many sub dirs present */
  115.   Parse Var destin sub '\' destin
  116.   direct=direct'\'sub
  117.   Call mkdir direct
  118. End
  119. return
  120.  
  121. copy_files:
  122. if save_dest \= ""  then do
  123.    'COPY clipsave.doc' direct
  124.    if version = "5" then do
  125.       'COPY clipsav5.exe' direct  
  126.    end     
  127.    if version = "4" then do
  128.       'COPY clipsav4.exe' direct  
  129.    end     
  130.    if version = "3" then do
  131.       'COPY clipsav3.exe' direct  
  132.    end     
  133.    if version = "S" then do
  134.       'COPY clipsave.exe' direct  
  135.    end     
  136. end
  137. return
  138.  
  139.