home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / units092.zip / Install.cmd < prev    next >
OS/2 REXX Batch file  |  2000-08-10  |  4KB  |  136 lines

  1. /* Install - Install / UnInstall for Unit Converter */
  2.  
  3. PARSE ARG action
  4. IF RxFuncQuery('SysLoadFuncs') THEN DO
  5.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  6.     CALL SysLoadFuncs
  7. END
  8. CALL SysCls
  9. action = TRANSLATE(LEFT(action,1))
  10. SELECT
  11.     WHEN action = 'I' THEN CALL InstallMe
  12.     WHEN action = 'U' THEN CALL UnInstallMe
  13.     OTHERWISE CALL WhatAction
  14. END
  15. Exit /* End of Install.cmd */
  16.  
  17. /* WhatAction - no action selected */
  18.  
  19. WhatAction:     PROCEDURE
  20.  
  21. CALL SysCls
  22. SAY 'Please enter installation parameter (I=Install, U=UnInstall, other=Enter):'
  23. PARSE PULL action
  24. SELECT
  25.     WHEN TRANSLATE(LEFT(action,1)) = 'I' THEN CALL InstallMe
  26.     WHEN TRANSLATE(LEFT(action,1)) = 'U' THEN CALL UnInstallMe
  27.     OTHERWISE CALL NoAction 'Installation failed.'
  28. END
  29. RETURN /* End of WhatAction */
  30.  
  31. /* NoAction - abort Install */
  32.  
  33. NoAction:   PROCEDURE
  34.  
  35. CALL SysCls
  36. PARSE ARG noinstmsg
  37. SAY noinstmsg
  38. SAY 'Press Enter to exit ...'
  39. PULL answer
  40. CALL SysCls
  41. Exit /* End of NoAction */
  42.  
  43. /* InstallMe - install Unit Converter */
  44.  
  45. InstallMe:  PROCEDURE
  46.  
  47. prgname = 'Unit Converter 0.92'
  48. cfgfiles = 'Convert.exe CONVERT.DAT Conbmp32.dll ENGLISH.INI English.inf'
  49. IF RIGHT(Directory(),2) = ':\' THEN DO
  50.     SAY 'Problem! '||prgname||' can not be installed in root directory.'
  51.     SAY 'Create directory for '||prgname||', copy files: '||cfgfiles||' there and start this procedure again.'
  52.     SAY 'Press Enter to exit ...'
  53.     PULL answer
  54.     Exit
  55. END
  56.  
  57. CALL SysCls
  58. SAY 'Welcome to '||prgname||' Installation procedure!'
  59. SAY 'Your files are in directory: '||Directory()
  60. SAY 'Program object for '||prgname||' will be created on your Desktop,'
  61. SAY 'Press "Y" (and Enter) to start Installation, any other key to exit...'
  62.  
  63. PARSE PULL answer
  64.  
  65. IF TRANSLATE(LEFT(answer,1)) <> "Y" THEN DO
  66.     CALL NoAction 'Installation aborted'
  67. END
  68.  
  69. SAY ' '
  70. SAY 'Checking files:'
  71. DO i = 1 TO WORDS(cfgfiles)
  72.     CALL SysFiletree Directory()||'\'||WORD(cfgfiles,i), 'chkfile', 'FO'
  73.     SELECT
  74.     WHEN chkfile.0 = 1 THEN SAY '- '||LEFT(WORD(cfgfiles,i),12)||' - OK'
  75.     OTHERWISE CALL NoAction LEFT(WORD(cfgfiles,i),12)||' - Missing file. Installation failed!'
  76.     END
  77. END
  78.  
  79. SAY 'Writing values to CONVERT.INI'
  80. CALL SysIni 'CONVERT.INI', 'Language', 'ENGLISH', 'English.inf'
  81. CALL SysIni 'CONVERT.INI', 'Language', 'CROATIAN', 'English.inf'
  82. CALL SysIni 'CONVERT.INI', 'Language', 'FRENCH', 'French.inf'
  83. CALL SysIni 'CONVERT.INI', 'Language', 'GERMAN', 'English.inf'
  84. CALL SysIni 'CONVERT.INI', 'Language', 'SWEDISH', 'Swedish.inf'
  85. CALL SysIni 'CONVERT.INI', 'Settings', 'CurrLang', 'ENGLISH'
  86. CALL SysIni 'CONVERT.INI', 'Settings', 'Font', '9.WarpSans'
  87. CALL SysIni 'CONVERT.INI', 'Settings', 'Position', '90 60 480 360'
  88. CALL SysIni 'CONVERT.INI', 'Settings', 'Precision', '15'
  89. CALL SysIni 'CONVERT.INI', 'Settings', 'Decimals', '3'
  90. CALL SysIni 'CONVERT.INI', 'Settings', 'Format', '0'
  91. CALL SysIni 'CONVERT.INI', 'Settings', 'Symbol', '0'
  92. CALL SysIni 'CONVERT.INI', 'Settings', 'Group', ' 1'
  93. CALL SysIni 'CONVERT.INI', 'Settings', 'OnExit', '1'
  94.  
  95. ProgTitle = prgname
  96. EXE = 'Convert.exe'
  97. ICO = 'Convert.ico'
  98. InstallDir = Directory()
  99. WorkDir = Directory()
  100. Setup = 'OBJECTID=<UNIT_CONVERTER_PROGRAM>;EXENAME='InstallDir'\'EXE';ICONFILE='InstallDir'\'ICO';STARTUPDIR='WorkDir''
  101. Action = 'U'
  102. dummy = SysCreateObject('WPProgram',ProgTitle,'<WP_DESKTOP>',Setup,Action)
  103. SELECT
  104.     WHEN dummy = 1 THEN SAY 'Creating '||prgname||' Program object - OK'
  105.     OTHERWISE SAY 'Creating '||prgname||' Program object - Error!'
  106. END
  107.  
  108. SAY ' '
  109. SAY 'Installation finished! Press Enter to exit ...'
  110. PULL answer
  111. CALL SysCls
  112. RETURN /* End of InstallMe */
  113.  
  114. /* UnInstallMe - uninstall Unit Converter */
  115.  
  116. UnInstallMe: PROCEDURE
  117.  
  118. prgname = 'Unit Converter 0.92'
  119. CALL SysCls
  120. SAY 'This is '||prgname||' UnInstallation procedure!'
  121. SAY 'Your files are in directory: '||Directory()
  122. SAY 'This procedure will destroy '||prgname||' Program object'
  123. SAY 'Press "Y" (and Enter) to start UnInstall, any other key to exit...'
  124. PULL answer
  125. IF answer <> "Y" THEN DO
  126.     CALL NoAction 'UnInstall terminated.'
  127. END
  128. SAY ' '
  129. SAY 'Destroying Program object'
  130. CALL SysDestroyObject '<UNIT_CONVERTER_PROGRAM>'
  131. SAY ' '
  132. SAY 'UnInstallation complete. You can delete files in directory '||Directory()
  133. SAY 'To install '||prgname||' again, start Install I. Press Enter to exit...'
  134. PULL answer
  135. RETURN /* End of UnInstallMe */
  136.