home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / afe_t11.zip / AFET-INS.CMD < prev    next >
OS/2 REXX Batch file  |  1994-09-30  |  5KB  |  232 lines

  1. /* AFExT 1.1 Installation Process */
  2.  
  3. '@echo off'
  4.  
  5. call rxfuncadd sysloadfuncs,rexxutil,sysloadfuncs
  6. call sysloadfuncs
  7.  
  8. call SysCls
  9. Say '';Say ''
  10.  
  11. Say '  AFE xT INSTALLATION !';Say '';say ''
  12.  
  13. /* check for presence of required files */
  14.  
  15. exeu=Stream('afeut.exe','c','query exists')<>''
  16. exea=Stream('afeat.exe','c','query exists')<>''
  17. icou=Stream('afeut.ico','c','query exists')<>''
  18. icoa=Stream('afeat.ico','c','query exists')<>''
  19. cfg=Stream('afet-cfg.exe','c','query exists')<>''
  20. dll=Stream('vrobj.dll','c','query exists')<>''
  21.  
  22. if exeu=0 then do
  23. say '  Can not find AFEuT.EXE !';exit
  24. end
  25.  
  26. if exea=0 then do
  27. say '  Can not find AFEaT.EXE !';exit
  28. end
  29.  
  30. if icou=0 then do
  31. say '  Can not find AFEuT.ICO !';exit
  32. end
  33.  
  34. if icoa=0 then do
  35. say '  Can not find AFEaT.ICO !';exit
  36. end
  37.  
  38. if cfg=0 then do
  39. say '  Can not find AFET-CFG.EXE !';exit
  40. end
  41.  
  42. if dll=0 then do
  43. say '  Can not find VROBJ.DLL !';exit
  44. end
  45.  
  46. Say '  Will copy programs to correct drive/directory and create a'
  47. say '  desktop objects...';say '';say ''
  48.  
  49. /* get the path to install AFExT files */
  50.  
  51. Say '  Give me the full pathname where you want AFExT installed,'
  52. Say '  including the drive.';say '';say '        Example: d:\bin\afe'
  53. say ''
  54.  
  55. pull pathname
  56.  
  57. if pathname='' then do
  58. say '';say '  No path specified !'
  59. exit
  60. end
  61.  
  62. /* if the user appended a "\" at the end of his path we don't want it */
  63.  
  64. if right(pathname,1)=="\" then do
  65. pathlength=length(pathname)
  66. pathlength=pathlength-1
  67. newafepath=substr(pathname,1,pathlength)
  68. pathname=newafepath
  69. end
  70.  
  71. /* however, if it's the root directory we do want the "\" */
  72.  
  73. if right(pathname,1)==":" then do
  74. pathname=''pathname'\'
  75. end
  76.  
  77. /* make sure it's a real path */
  78.  
  79. call SysFileTree pathname,'file','d'
  80. if file.0=0 then do
  81. rc=SysMkDir(''pathname'')
  82.   if rc>0 then do
  83.   say '';say '  Path does not exist and can not be created !'
  84.   exit
  85.   end
  86. end
  87.  
  88. call SysCls
  89. say '';say '  Copying files...'
  90.  
  91. /* if we appended a "\" we now need to remove it */
  92.  
  93. if right(pathname,1)=="\" then do
  94. pathlength=length(pathname)
  95. pathlength=pathlength-1
  96. newafepath=substr(pathname,1,pathlength)
  97. pathname=newafepath
  98. end
  99.  
  100. /* if there are already AFE files there let's make sure that they
  101.    can be overwritten */
  102.  
  103. over=Stream(''pathname'\afe*','c','query exists')<>''
  104. if over>0 then do
  105. call SysFileTree ''pathname'\afe*','files','f','*-*+*','-----'
  106.  
  107. /* if there is an old AFET.INI get rid of it */
  108.  
  109. if Stream(''pathname'\afet.ini','c','query exists')<>'' then do
  110. call SysFileDelete ''pathname'\afet.ini';end
  111.  
  112. end
  113.  
  114. /* if this is the root we need that trailing "\" */
  115.  
  116. if right(pathname,1)==":" then do
  117. pathname=''pathname'\'
  118. end
  119.  
  120. /* copy the files */
  121.  
  122. 'copy afeut.exe 'pathname''
  123. 'copy afeat.exe 'pathname''
  124. 'copy afeut.ico 'pathname''
  125. 'copy afeat.ico 'pathname''
  126. 'copy afet-cfg.exe 'pathname''
  127.  
  128. /* need to get rid of that trailing "\" again */
  129.  
  130. if right(pathname,1)=="\" then do
  131. pathlength=length(pathname)
  132. pathlength=pathlength-1
  133. newafepath=substr(pathname,1,pathlength)
  134. pathname=newafepath
  135. end
  136.  
  137. call SysCls;say '';say '  Done!';SAY '';say '  Now I need a place to put the DLL';say ''
  138. say '  Give me a full pathname (must be in your CONFIG.SYS LIBPATH statement)';say ''
  139. say '       Example: c:\os2\dll'
  140. say ''
  141.  
  142. /* now get the path to put the DLL file */
  143.  
  144. pull DLLpath
  145.  
  146. if dllpath='' then do
  147. say '';say '  No path specified !'
  148. exit
  149. end
  150.  
  151. if right(DLLpath,1)=="\" then do
  152. pathlength=length(DLLpath)
  153. pathlength=pathlength-1
  154. newDLLpath=substr(DLLpath,1,pathlength)
  155. DLLpath=newDLLpath
  156. end
  157.  
  158. if right(DLLpath,1)==":" then do
  159. DLLpath=''DLLpath'\'
  160. end
  161.  
  162. call SysFileTree dllpath,'file','d'
  163. if file.0=0 then do
  164. say ' Path does not exist !';exit;end
  165.  
  166. call SysCls
  167. say '';say '  Copying files...'
  168.  
  169. if right(DLLpath,1)=="\" then do
  170. pathlength=length(DLLpath)
  171. pathlength=pathlength-1
  172. newDLLpath=substr(DLLpath,1,pathlength)
  173. DLLpath=newDLLpath
  174. end
  175.  
  176. over=Stream(''DLLpath'\vrobj.dll','c','query exists')<>''
  177. if over>0 then do
  178.    call SysFileTree ''DLLpath'\vrobj.dll','files','f','*-*+*','-----'
  179.  end
  180.  
  181. if right(DLLpath,1)==":" then do
  182. DLLpath=''DLLpath'\'
  183. end
  184.  
  185. 'copy vrobj.dll 'dllpath''
  186.  
  187. call SysCls;say '';say '  Done!';say ''
  188.  
  189. Say '  Now creating Desktop objects...'
  190.  
  191. /* create a desktop objects for AFExT */
  192.  
  193. classname='WPProgram'
  194. title='AFE aTiny 1.0'
  195. location='<WP_DESKTOP>'
  196. setup='MINIMIZED=YES;PROGTYPE=PM;EXENAME='pathname'\AFEAT.EXE;OBJECTID=<WP_DESKTOP_AFEAT>;ICONFILE='pathname'\AFEAT.ICO;STARTUPDIR='pathname';'
  197.  
  198. result=SysCreateObject(classname,title,location,setup,'r')
  199.  
  200. If result<>1 Then signal notcreated
  201.  
  202. classname='WPProgram'
  203. title='AFE uTiny 1.0'
  204. location='<WP_DESKTOP>'
  205. setup='MINIMIZED=YES;PROGTYPE=PM;EXENAME='pathname'\AFEUT.EXE;OBJECTID=<WP_DESKTOP_AFEUT>;ICONFILE='pathname'\AFEUT.ICO;STARTUPDIR='pathname';'
  206.  
  207. result=SysCreateObject(classname,title,location,setup,'r')
  208.  
  209. If result<>1 Then signal notcreated
  210.  
  211. call SysCls
  212. say '';say '  Objects created!';Say '';Say '  All done!';SAY ''
  213. say '  The AFExT program objects are installed on your desktop.'
  214. say '';say '';say '  Ready to start AFExT Configuration...'
  215. say '';say ''
  216.  
  217. 'pause'
  218.  
  219. /* start the program */
  220.  
  221. call SysCls
  222. call syssetobjectdata '<WP_DESKTOP_AFEAT>','open=default'
  223. 'exit'
  224. end
  225.  
  226. notcreated:
  227. call SysCls
  228. say '';say '  Not created! Return code='result
  229. exit
  230. end
  231.  
  232.