home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu / 2008-06-02_hobbes.nmsu.edu.zip / new / ths_105.zip / installs.cmd next >
OS/2 REXX Batch file  |  2008-05-19  |  3KB  |  95 lines

  1. /* REXX file to install TextHelper on the desktop     */
  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@intcon.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. say "TextHelper installation"
  13. say "Enter destination drive and directory"
  14. say "for example C:\OS2\APPS"
  15. say "to install in the curent directory just press enter"
  16.  
  17. pull dest
  18. call setup_dir(dest) 
  19.  
  20. call copy_files
  21. call MKOBJ
  22. exit
  23.  
  24. check_ok:
  25. /*  say  'Okay to continue(Y/N) ? '         */
  26.   k = SysGetKey('NOECHO') 
  27.   if k = 'Y' | k = 'y'  then return
  28.   say 'halting'
  29.     exit
  30.  
  31.  
  32. mkdir:  /* Procedure for creating dir */
  33.   Parse Arg dir
  34.   rc = SysMkDir(dir)
  35.   If (rc = 0 | rc = 5) Then Return
  36.   Say 'Problem creating destination directory "'dir'"'
  37.   Exit
  38.  
  39.  
  40. MKOBJ:
  41. Settings = 'EXENAME='direct||'\ths.exe;'
  42. Settings = Settings||'PROGTYPE=PM;MINIMIZED=NO;'
  43. Settings = Settings||'CCVIEW=NO;'
  44. Settings = Settings||'STARTUPDIR='||direct';'
  45. rc=SysCreateObject('WPProgram','TextHelper Shareware','<WP_DESKTOP>',Settings,'R');
  46.  
  47. if rc = 1 then Say "TextHelper installed on desktop"
  48.  
  49. say "Running eCS?  (Y/N)"
  50.   k = SysGetKey('NOECHO') 
  51.   if k = 'Y' | k = 'y'  then 
  52.         Settings = 'EXENAME=view.exe;'
  53.   else
  54.         Settings = 'EXENAME=viewhelp.exe;'
  55.  
  56. Settings = Settings||'PROGTYPE=PM;MINIMIZED=NO;'
  57. Settings = Settings||'CCVIEW=NO;'
  58. Settings = Settings||'PARAMETERS='||direct||'\th.hlp;'
  59. Settings = Settings||'STARTUPDIR='||direct
  60. rc=SysCreateObject('WPProgram','TextHelper Information','<WP_DESKTOP>',Settings,'R');
  61. if rc = 1 then Say "TextHelper Help installed on desktop"
  62.  
  63. return
  64.  
  65. setup_dir:      /* accept install path and create it if needed */
  66.                 /* the desired install path is in ARG(1) */
  67.                 /* if no path is specified current directory is used*/
  68.  
  69. Parse Arg destin  /* parameter of setup_dir */
  70.  
  71. save_dest = destin    /*  save original destin to */
  72.                       /*  determine if copy needed */
  73.  
  74. If destin = "" Then destin = Directory()
  75.  
  76. Say "Shall I install in "destin"?    (Y/N)"
  77. Call Check_Ok  /* your check routine */
  78.  
  79. Parse Var destin direct ':\' destin   /* get drive name only */
  80. direct=direct':'
  81.  
  82. Do Until destin = ""     /* No matter how many sub dirs present */
  83.   Parse Var destin sub '\' destin
  84.   direct=direct'\'sub
  85.   Call mkdir direct
  86. End
  87. return
  88.  
  89. copy_files:
  90. if save_dest \= ""  then do
  91.    'COPY th.hlp' direct
  92.    'COPY ths.exe' direct  
  93.    end     
  94. return
  95.