home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / unit091.zip / units091.zip / Install.cmd < prev    next >
OS/2 REXX Batch file  |  2000-07-06  |  4KB  |  132 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=Exit):'
  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.91'
  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. PARSE PULL answer
  63.  
  64. IF TRANSLATE(LEFT(answer,1)) <> "Y" THEN DO
  65.     CALL NoAction 'Installation aborted'
  66. END
  67.  
  68. SAY ' '
  69. SAY 'Checking files:'
  70. DO i = 1 TO WORDS(cfgfiles)
  71.     CALL SysFiletree Directory()||'\'||WORD(cfgfiles,i), 'chkfile', 'FO'
  72.     SELECT
  73.     WHEN chkfile.0 = 1 THEN SAY '- '||LEFT(WORD(cfgfiles,i),12)||' - OK'
  74.     OTHERWISE CALL NoAction LEFT(WORD(cfgfiles,i),12)||' - Missing file. Installation failed!'
  75.     END
  76. END
  77.  
  78. SAY 'Writing values to CONVERT.INI'
  79. CALL SysIni 'CONVERT.INI', 'Language', 'ENGLISH', 'English.inf'
  80. CALL SysIni 'CONVERT.INI', 'Language', 'CROATIAN', 'English.inf'
  81. CALL SysIni 'CONVERT.INI', 'Language', 'FRENCH', 'French.inf'
  82. CALL SysIni 'CONVERT.INI', 'Language', 'GERMAN', 'English.inf'
  83. CALL SysIni 'CONVERT.INI', 'Language', 'SWEDISH', 'Swedish.inf'
  84. CALL SysIni 'CONVERT.INI', 'Settings', 'CurrLang', 'ENGLISH'
  85. CALL SysIni 'CONVERT.INI', 'Settings', 'Font', '9.WarpSans'
  86. CALL SysIni 'CONVERT.INI', 'Settings', 'Position', '90 60 480 360'
  87. CALL SysIni 'CONVERT.INI', 'Settings', 'Precision', '15'
  88. CALL SysIni 'CONVERT.INI', 'Settings', 'Decimals', '3'
  89. CALL SysIni 'CONVERT.INI', 'Settings', 'Format', '0'
  90. CALL SysIni 'CONVERT.INI', 'Settings', 'Symbol', '0'
  91. CALL SysIni 'CONVERT.INI', 'Settings', 'Group', ' 1'
  92. CALL SysIni 'CONVERT.INI', 'Settings', 'OnExit', '1'
  93.  
  94. ProgTitle = prgname
  95. EXE = 'Convert.exe'
  96. ICO = 'Convert.ico'
  97. InstallDir = Directory()
  98. WorkDir = Directory()
  99. Setup = 'OBJECTID=<UNIT_CONVERTER_PROGRAM>;EXENAME='InstallDir'\'EXE';ICONFILE='InstallDir'\'ICO';STARTUPDIR='WorkDir''
  100. Action = 'U'
  101. SAY 'Creating '||prgname||' Program object'
  102. CALL SysCreateObject 'WPProgram',ProgTitle,'<WP_DESKTOP>',Setup,Action
  103.  
  104. SAY ' '
  105. SAY 'Installation finished! Press Enter to exit ...'
  106. PULL answer
  107. CALL SysCls
  108. RETURN /* End of InstallMe */
  109.  
  110. /* UnInstallMe - uninstall Unit Converter */
  111.  
  112. UnInstallMe: PROCEDURE
  113.  
  114. prgname = 'Unit Converter 0.91'
  115. CALL SysCls
  116. SAY 'This is '||prgname||' UnInstallation procedure!'
  117. SAY 'Your files are in directory: '||Directory()
  118. SAY 'This procedure will destroy '||prgname||' Program object'
  119. SAY 'Press "Y" (and Enter) to start UnInstall, any other key to exit...'
  120. PULL answer
  121. IF answer <> "Y" THEN DO
  122.     CALL NoAction 'UnInstall terminated.'
  123. END
  124. SAY ' '
  125. SAY 'Destroying Program object'
  126. CALL SysDestroyObject '<UNIT_CONVERTER_PROGRAM>'
  127. SAY ' '
  128. SAY 'UnInstallation complete. You can delete files in directory '||Directory()
  129. SAY 'To install '||prgname||' again, start Install I. Press Enter to exit...'
  130. PULL answer
  131. RETURN /* End of UnInstallMe */
  132.