home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 24 DOS / 24-DOS.zip / 4dos600.zip / JPOS2INS.CMD < prev    next >
OS/2 REXX Batch file  |  1997-07-30  |  21KB  |  759 lines

  1. /* JPOS2INS.CMD
  2.    24-Jul-97
  3.  
  4.       Creates/removes Desktop objects and modifies CONFIG.SYS for
  5.        JP Software's "4DOS", "4OS2", and "Take Command for OS/2"
  6.  
  7.          Copyright 1997, JP Software Inc., All Rights Reserved.
  8.    
  9. Parameters:
  10. "4DOS" "directory" "CreateFolder"
  11.        "directory" "RemoveFolder"
  12.  
  13. "4OS2" "directory" "UpdatePaths" "config.in" "config.out" "file.log" "cmd.new"
  14.        "directory" "RestorePaths" "config.in" "config.out" "shell.old" "spec.old"
  15.        "directory" "UpdateINI" "ini.in" "ini.out"
  16.        "directory" "CreateFolder"
  17.        "directory" "RemoveFolder"
  18.     
  19. "TCMD" "directory" "UpdatePaths" "config.in" "config.out"
  20.        "directory" "RestorePaths" "config.in" "config.out"
  21.        "directory" "UpdateINI" "ini.in" "ini.out"
  22.        "directory" "CreateFolder"
  23.        "directory" "RemoveFolder"
  24.  
  25. Notes: 
  26. 1) All file names must be fully qualified
  27. 2) Parameters are not checked for validity
  28. 3) Double quote is REQUIRED between parameters as shown above
  29.  
  30.  
  31. */
  32.  
  33. CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs';
  34. CALL SysLoadFuncs;
  35.  
  36. container  = '<WP_DESKTOP>'
  37. jpFolder = '<WP_JP_CMDPRMPT>'
  38. os2ExeId = '<WP_JP_4OS2_EXE>'
  39. os2HelpId = '<WP_JP_4OS2_HELP>'
  40. dosExeId = '<WP_JP_4DOS_EXE>'
  41. dosHelpId = '<WP_JP_4DOS_HELP>'
  42. tcmdExeId = '<WP_JP_TCMDOS2_EXE>'
  43. tcmdHelpId = '<WP_JP_TCMDOS2_HELP>'
  44.  
  45. /*
  46.  ****************************************************************************
  47.  ** MAIN
  48.  ****************************************************************************
  49. */
  50. /* Want case sensitive arguments for HPFS directory names */
  51. PARSE ARG '"' product '"' '"' comDir '"' '"' command '"' '"' parm1 '"' '"' parm2 '"' '"' parm3 '"' '"' parm4 '"' 
  52.  
  53. /* Shift case of command and platform */
  54. PARSE UPPER VALUE command WITH command
  55. PARSE UPPER VALUE product WITH product
  56.  
  57. /* Remove '\' from end of directory if it exists */
  58. comDir = STRIP(comDir)
  59. IF (RIGHT(comDir,1) == '\') THEN
  60.   comDir = LEFT(comDir, LENGTH(comDir) - 1)
  61.  
  62. mainRC = 1
  63.  
  64. IF product == '4DOS' THEN DO
  65.   productName = '4DOS'
  66.   IF command == 'CREATEFOLDER' THEN DO
  67.     mainRC = CreateJPFolder()
  68.     container = jpFolder
  69.   
  70.     IF mainRC = 0 THEN
  71.       mainRC = Create4DOSObjects()
  72.  
  73.     SAY 'Press any key to continue ...'
  74.     SYSGETKEY(NOECHO)
  75.  
  76.   END
  77.   ELSE IF command == 'REMOVEFOLDER' THEN DO
  78.     mainRC = Remove4DOSObjects()
  79.     SAY 'Press any key to continue ...'
  80.     SYSGETKEY(NOECHO)
  81.   END
  82.   ELSE
  83.     CALL ArgError
  84. END  /* 4DOS */
  85.  
  86. ELSE IF product == '4OS2' THEN DO
  87.   productName = '4OS2'
  88.   IF command == 'UPDATEPATHS' THEN
  89.     mainRC = UpdatePaths()
  90.   ELSE IF command == 'RESTOREPATHS' THEN
  91.     mainRC = RestorePaths()
  92.   ELSE IF command == 'UPDATEINI' THEN
  93.     mainRC = UpdateINI()
  94.   ELSE IF command == 'CREATEFOLDER' THEN DO
  95.     mainRC = CreateJPFolder()
  96.     container = jpFolder
  97.   
  98.     IF mainRC = 0 THEN
  99.       mainRC = Create4OS2Objects()
  100.      
  101.   END
  102.   ELSE IF command == 'REMOVEFOLDER' THEN
  103.     mainRC = Remove4OS2Objects()
  104.   ELSE
  105.     CALL ArgError
  106. END  /* 4OS2 */
  107.  
  108. ELSE IF product == 'TCMD' THEN DO
  109.   productName = 'Take Command for OS/2'
  110.   IF command == 'UPDATEPATHS' THEN 
  111.     mainRC = UpdatePaths()
  112.   ELSE IF command == 'RESTOREPATHS' THEN 
  113.     mainRC = RestorePaths()
  114.   ELSE IF command == 'UPDATEINI' THEN
  115.     mainRC = UpdateINI()
  116.   ELSE IF command == 'CREATEFOLDER' THEN DO
  117.     mainRC = CreateJPFolder()
  118.     container = jpFolder
  119.   
  120.     IF mainRC = 0 THEN
  121.       mainRC = CreateTCMDObjects()
  122.      
  123.     /* Look for 4DOS and add to folder? */
  124.   
  125.   END
  126.   ELSE IF command == 'REMOVEFOLDER' THEN
  127.     mainRC = RemoveTCMDObjects()
  128.   ELSE
  129.     CALL ArgError
  130. END  /* TCMD */
  131. ELSE DO 
  132.   CALL ArgError
  133. END
  134.  
  135. EXIT mainRC
  136. /*
  137.  ****************************************************************************
  138.  ** END MAIN
  139.  ****************************************************************************
  140. */
  141.  
  142. UpdatePaths:
  143.  
  144.   SAY ''
  145.   CALL CHAROUT ,'Adding ' || productName || ' directory to CONFIG.SYS paths'
  146.   IF product == '4OS2' THEN DO
  147.     CALL LINEOUT ,' and'
  148.     CALL CHAROUT ,'adding ' || productName || ' executable to OS2_SHELL ' ||,
  149.                    'and COMSPEC variables'
  150.   END
  151.   
  152.   configSys = parm1
  153.   configSysTemp = parm2
  154.   logFile = parm3
  155.   cmdFile = parm4
  156.  
  157.   /* Delete output file name; otherwise LINEOUT will append to file */
  158.   delRC = SysFileDelete(configSysTemp)
  159.  
  160.   PARSE UPPER VALUE comDir WITH comDirUp
  161.   holdDir = comDir || ';'
  162.   holdDirUp = comDirUp || ';'
  163.   
  164.   /* Flags */
  165.   libFound = 0
  166.   bookFound = 0
  167.   dFound = 0
  168.   shellFound = 0
  169.   specFound = 0
  170.  
  171.  
  172.   DO WHILE LINES(configSys) > 0
  173.     /* Read one line of file */
  174.     inputLine = LINEIN(configSys) 
  175.     
  176.     /* Get path key and info */
  177.     PARSE VALUE inputLine WITH envarKey '=' envarInfo     
  178.      PARSE UPPER VALUE envarKey WITH envarKey
  179.      PARSE UPPER VALUE envarInfo WITH envarInfoUp
  180.     
  181.     envarKey = STRIP(envarKey)
  182.     pathFound = 0
  183.     envarFound = 0
  184.     
  185.     /* Check to see if this is one of the lines we want to modify */
  186.     IF (envarKey == 'LIBPATH') THEN DO 
  187.       libFound = 1
  188.       pathFound = 1
  189.     END
  190.     IF (envarKey == 'SET BOOKSHELF') THEN DO
  191.       bookFound = 1
  192.       pathFound = 1
  193.     END
  194.     IF (envarKey == 'SET DPATH') THEN DO
  195.       dFound = 1
  196.       pathFound = 1
  197.     END
  198.  
  199.     IF product == '4OS2' THEN DO
  200.       IF (envarKey == 'SET OS2_SHELL') THEN DO 
  201.          currShell = envarInfo 
  202.         shellFound = 1
  203.         envarFound = 1
  204.       END
  205.       IF (envarKey == 'SET COMSPEC') THEN DO 
  206.          currSpec = envarInfo 
  207.         specFound = 1
  208.         envarFound = 1
  209.       END
  210.     END  /* IF 4OS2 */
  211.     
  212.  
  213.     /* Add our directory if it is not already in path */
  214.     IF ((pathFound = 1) & (POS(holdDirUp, envarInfoUp) = 0)) THEN DO     
  215.       /* Remove trailing spaces */
  216.       inputLine = STRIP(inputLine,'t')
  217.  
  218.       /* IF path does not end in ';' or '=', add ';' to end */
  219.       IF ((RIGHT(inputLine,1) \== ';') & (RIGHT(inputLine,1) \== '=')) THEN
  220.         inputLine = inputLine || ';'  
  221.  
  222.       /* Add our path to end */
  223.       inputLine = inputLine || holdDirUp
  224.  
  225.     END  /* pathFound */
  226.  
  227.     IF (envarFound = 1) THEN DO
  228.       /* Write our environment var instead */
  229.       inputLine = envarKey || '=' || cmdFile
  230.     END  /* envarFound */
  231.        
  232.     /* IF none of the keywords were found, inputLine is unchanged */
  233.     CALL LINEOUT configSysTemp,inputLine
  234.   
  235.   END  /* DO while LINES > 0 */
  236.  
  237.   
  238.   /* IF any paths not found */
  239.   IF ((libFound = 0) | (bookFound = 0) | (dFound = 0)) THEN DO
  240.     /* Add the path variables that we did not find in the file */
  241.     IF (libFound = 0) THEN
  242.       CALL LINEOUT configSysTemp,'LIBPATH=' || holdDirUp
  243.     IF (bookFound = 0) THEN
  244.       CALL LINEOUT configSysTemp,'SET BOOKSHELF=' || holdDirUp
  245.     IF (dFound = 0) THEN
  246.       CALL LINEOUT configSysTemp,'SET DPATH=' || holdDirUp
  247.   END  /* IF any paths not found */
  248.      
  249.   /* If 4OS2 install and either envar not found */
  250.   IF ((product == '4OS2') & ((shellFound = 0) | (specFound = 0))) THEN DO
  251.     /* Add the environment variables that we did not find in the file */
  252.     IF (shellFound = 0) THEN
  253.       CALL LINEOUT configSysTemp,'SET OS2_SHELL=' || cmdFile
  254.     IF (specFound = 0) THEN
  255.       CALL LINEOUT configSysTemp,'SET COMSPEC=' || cmdFile
  256.   END  /* If either envar not found */
  257.  
  258.   /* Close files */ 
  259.   CALL LINEOUT configSys
  260.   CALL LINEOUT configSysTemp
  261.  
  262.   /* Write current OS2_SHELL and COMSPEC to log only if they don't reference 
  263.       the same copy of 4OS2.EXE (eg. when someone runs install twice for the
  264.       the same version)
  265.  
  266.      Shareware installation has no logging; need to handle a null log file
  267.       name
  268.    */
  269.   IF (logfile \== '')  THEN DO
  270.     IF ((shellFound = 1) & (POS(comDirUp||'\4OS2.EXE', UCase(currShell)) = 0)) THEN DO     
  271.       CALL WriteLog logFile, 'OS2_SHELL', currShell 
  272.     END
  273.     IF ((specFound = 1) & (POS(comDirUp||'\4OS2.EXE', UCase(currShell)) = 0)) THEN DO     
  274.       CALL WriteLog logFile, 'COMSPEC', currSpec 
  275.     END
  276.   END
  277.   
  278.   CALL charout ,'... OK!'
  279.   SAY ''
  280.  
  281. RETURN 0
  282.  
  283.  
  284. /****************************************************************************/
  285. WriteLog:
  286.   
  287.   PARSE ARG logFileName , matchParm , valueParm 
  288.   PARSE UPPER VALUE matchParm WITH matchParm
  289.   
  290.   n = 0
  291.   itemFound = 0
  292.   dataArray. = '' 
  293.   
  294.   DO WHILE LINES(logFileName) > 0
  295.     /* Read one line of file */
  296.     inputData = LINEIN(logFileName) 
  297.     
  298.     /* Get key and info */
  299.     PARSE VALUE inputData WITH logKey '=' logInfo     
  300.      PARSE UPPER VALUE logKey WITH logKey
  301.     
  302.     logKey = STRIP(logKey)
  303.     
  304.     /* Check to see if this is the line we want to modify */
  305.     IF (logKey == matchParm) THEN DO 
  306.       /* Write our environment var instead */
  307.       inputData = logKey || '=' || valueParm
  308.       itemFound = 1
  309.     END  
  310.        
  311.     /* Store the line in the array
  312.        If none of the keywords were found, inputLine is unchanged 
  313.      */
  314.     dataArray.n = inputData
  315.     n = n + 1
  316.   
  317.   END  /* DO while LINES > 0 */
  318.   
  319.   /* Close file */ 
  320.   CALL LINEOUT logFileName
  321.   
  322.   /* If not found */
  323.   IF (itemFound = 0) THEN DO
  324.     /* Add item to end of file */
  325.     CALL LINEOUT logFileName, matchParm || '=' || valueParm
  326.   END
  327.   ELSE DO
  328.     /* Erase log file and rewrite */
  329.      nn = 0
  330.      IF (SysFileDelete(logFileName) = 0) THEN DO WHILE (nn < n)
  331.       CALL LINEOUT logFileName, dataArray.nn
  332.         nn = nn + 1
  333.      END
  334.      ELSE DO 
  335.        /* Error */
  336.       SAY 'ERROR: Could not modify the installation log file'
  337.     END  
  338.   END
  339.  
  340.   /* Close file */ 
  341.   CALL LINEOUT logFileName
  342.   
  343. RETURN 0
  344.  
  345.  
  346. /****************************************************************************/
  347. RestorePaths:
  348.  
  349.   SAY ''
  350.   CALL CHAROUT ,'Removing ' || productName || ' directory from ' ||,
  351.                 'CONFIG.SYS paths'
  352.   IF product == '4OS2' THEN DO
  353.     CALL LINEOUT ,' and'
  354.     CALL charout ,'removing ' || productName || ' from OS2_SHELL and ' ||,
  355.                   'COMSPEC variables'
  356.   END
  357.   
  358.   configSys = parm1
  359.   configSysTemp = parm2
  360.   shellLine = parm3
  361.   specLine = parm4
  362.   holdDir = comDir || ';'
  363.   
  364.   rcRestorePaths = 0
  365.   
  366.   /* Delete output file name; otherwise LINEOUT will append to file */
  367.   delRC = SysFileDelete(configSysTemp)
  368.  
  369.   IF product == '4OS2' THEN DO
  370.     /* Verify that the old OS2_SHELL and COMSPEC files exist */
  371.     PARSE VALUE shellLine WITH holdFile .
  372.     IF STREAM(STRIP(holdFile), C, QUERY EXISTS) \= '' THEN
  373.       shellFound = 1
  374.     ELSE
  375.       shellFound = 0
  376.  
  377.     PARSE VALUE specLine WITH holdFile .
  378.     IF STREAM(STRIP(holdFile), C, QUERY EXISTS) \= '' THEN
  379.       specFound = 1
  380.     ELSE
  381.       specFound = 0
  382.   END  /* If 4OS2 */
  383.  
  384.   PARSE UPPER VALUE holdDir WITH holdDirUp
  385.   
  386.   DO WHILE LINES(configSys) > 0
  387.     /* Read one line of file */
  388.     inputLine = LINEIN(configSys) 
  389.      
  390.     PARSE UPPER VALUE inputLine WITH inputLineUp
  391.   
  392.     /* Get path key and info */
  393.     PARSE VALUE inputLineUp WITH envarKey '=' envarInfo     
  394.     
  395.     envarKey = STRIP(envarKey)
  396.     
  397.     /* If this is one of the paths we want to modify */
  398.     IF (envarKey == 'LIBPATH') | ,
  399.        (envarKey == 'SET BOOKSHELF') | ,
  400.        (envarKey == 'SET DPATH') THEN DO
  401.       
  402.       /* Find our directory (case insensitive) */
  403.       envarPos = POS(holdDirUp, inputLineUp)
  404.       
  405.       IF (envarPos \= 0) THEN DO
  406.         inputLine = DELSTR(inputLine, envarPos, LENGTH(holdDirUp))
  407.       END  
  408.  
  409.     END  /* Path found */
  410.  
  411.     IF product == '4OS2' THEN DO
  412.       /* If we find an OS2_SHELL or COMSPEC line, replace it only if we know
  413.           that the old file exists, otherwise flag it as an error
  414.       */
  415.       IF (envarKey == 'SET OS2_SHELL') THEN DO
  416.         IF (shellFound = 1) THEN
  417.           inputLine = envarKey || '=' || shellLine
  418.         ELSE
  419.           rcRestorePaths = 1
  420.       END
  421.  
  422.       IF (envarKey == 'SET COMSPEC') THEN DO
  423.         IF (specFound = 1) THEN
  424.           inputLine = envarKey || '=' || specLine
  425.         ELSE
  426.           rcRestorePaths = 1
  427.       END
  428.     END  /* If 4OS2 */
  429.        
  430.     /* IF none of the keywords were found, inputLine is unchanged */
  431.     CALL LINEOUT configSysTemp, inputLine
  432.  
  433.   END  /* DO while LINES > 0 */
  434.   
  435.   /* Close files */ 
  436.   CALL LINEOUT configSys
  437.   CALL LINEOUT configSysTemp
  438.  
  439.   IF rcRestorePaths = 0 THEN
  440.     CALL charout ,'... OK!'
  441.   ELSE
  442.     CALL charout ,'... ERROR!'
  443.  
  444.   SAY ''
  445.  
  446. RETURN rcRestorePaths
  447.  
  448.  
  449. /****************************************************************************/
  450. UpdateINI:
  451.  
  452.   iniFile = parm1
  453.   iniFileTemp = parm2
  454.   
  455.   SAY ''
  456.   CALL CHAROUT ,'Updating ' || iniFile
  457.   
  458.   /* Delete output file name; otherwise LINEOUT will append to file */
  459.   delRC = SysFileDelete(iniFileTemp)
  460.  
  461.   /* Check to see if we have [4OS2] as first non-blank, non-comment line */
  462.   IF (product == '4OS2') THEN DO
  463.     searchDone = 0
  464.     foundSection = 0
  465.  
  466.     DO WHILE (LINES(iniFile) > 0) & (searchDone = 0)
  467.       inputLine = STRIP(LINEIN(iniFile))
  468.  
  469.       /* Read until we hit the first line to contain text other than a
  470.          comment
  471.       */
  472.       IF (inputLine \== '') & (LEFT(inputLine, 1) \== ';') THEN DO
  473.         searchDone = 1
  474.         PARSE UPPER VALUE inputLine WITH '[' sectionName ']'
  475.         IF (sectionName == '4OS2') THEN
  476.           foundSection = 1
  477.       END
  478.  
  479.     END  /* DO while LINES > 0 */
  480.  
  481.     /* If we did not find [4OS2], write it to the first line of output file */
  482.     IF foundSection = 0 THEN
  483.       CALL LINEOUT iniFileTemp, '[4OS2]'
  484.  
  485.     /* Close input file */
  486.     CALL LINEOUT iniFile
  487.   END  /* If 4OS2 */
  488.  
  489.  
  490.   DO WHILE LINES(iniFile) > 0
  491.     /* Read one line of file */
  492.     inputLine = LINEIN(iniFile) 
  493.      
  494.     /* Get path key and info */
  495.     PARSE VALUE inputLine WITH envarKey '=' envarInfo     
  496.     PARSE UPPER VALUE envarKey WITH envarKey 
  497.     
  498.     envarKey = STRIP(envarKey)
  499.     envarInfo = STRIP(envarInfo)
  500.     
  501.     /* If this is one of the directives we want to modify */
  502.     IF (product == '4OS2') & (envarKey == '4STARTPATH') THEN
  503.       inputLine = '4StartPath=' || comDir
  504.     
  505.     IF (product == 'TCMD') & (envarKey == 'TCSTARTPATH') THEN
  506.       inputLine = 'TCStartPath=' || comDir
  507.     
  508.     IF envarKey == 'HISTWINLEFT' THEN
  509.       inputLine = 'PopupWinLeft=' || envarInfo
  510.     ELSE IF envarKey == 'HISTWINTOP' THEN
  511.       inputLine = 'PopupWinTop=' || envarInfo
  512.     ELSE IF envarKey == 'HISTWINWIDTH' THEN
  513.       inputLine = 'PopupWinWidth=' || envarInfo
  514.     ELSE IF envarKey == 'HISTWINHEIGHT' THEN
  515.       inputLine = 'PopupWinHeight=' || envarInfo
  516.     ELSE IF envarKey == 'HISTWINCOLORS' THEN
  517.       inputLine = 'PopupWinColors=' || envarInfo
  518.  
  519.     /* If none of the keywords were found, inputLine is unchanged */
  520.     CALL LINEOUT iniFileTemp, inputLine
  521.  
  522.   END  /* DO while LINES > 0 */
  523.   
  524.   /* Close files */ 
  525.   CALL LINEOUT iniFile
  526.   CALL LINEOUT iniFileTemp
  527.  
  528.   CALL charout ,'... OK!'
  529.   SAY ''
  530.  
  531. RETURN 0
  532.  
  533.  
  534. /****************************************************************************/
  535. CreateJPFolder:
  536.  
  537.   /* Create/update the JP command prompts folder */
  538.   classname = 'WPFolder'
  539.   objectname = 'JP Software'||'0d0A'x||'Command Processors'
  540.   msgtext = 'JP Software Command Processors folder'
  541.   location = container
  542.   setup = 'ICONFILE='||comDir||'\JPFOLDER.ICO;'||,
  543.           'ICONNFILE=1,'||comDir||'\JPOPNFLD.ICO;'||,
  544.           'OBJECTID='jpFolder||';'
  545.   CALL DOCreateObject
  546. RETURN RESULT
  547.  
  548.  
  549. /****************************************************************************/
  550. Create4DOSObjects:
  551.  
  552.   /* Create/update the main executable */
  553.   classname = 'WPProgram'
  554.   objectname = '4DOS Window'
  555.   msgtext = '4DOS Window'
  556.   location = container
  557.   setup = 'EXENAME=*;'||,
  558.           'ICONFILE='||comDir||'\4DOSOS2.ICO;'||,
  559.           'STARTUPDIR='||comDir||';'||,
  560.           'PROGTYPE=WINDOWEDVDM;'||,
  561.           'OBJECTID='dosExeId||';'||,
  562.           'SET DOS_SHELL='||comDir||'\4DOS.COM '||comdir||' /P;'
  563.   CALL DOCreateObject
  564.   
  565.   IF RESULT = 0 THEN DO
  566.     /* Create/update the help object */
  567.     classname = 'WPProgram'
  568.     objectname = '4DOS Help'
  569.     msgtext = '4DOS Help'
  570.     location = container
  571.     setup = 'EXENAME=*;'||,
  572.             'PARAMETERS=/C '||comDir||'\4HELP.EXE;'||,
  573.             'PROGTYPE=WINDOWEDVDM;'||,
  574.             'OBJECTID='dosHelpId||';'||,
  575.             'SET DOS_SHELL='||comDir||'\4DOS.COM '||comdir||' /P;'
  576.     CALL DOCreateObject
  577.   END
  578. RETURN RESULT
  579.  
  580.  
  581. /****************************************************************************/
  582. Create4OS2Objects:
  583.  
  584.   /* Create/update the main executable */
  585.   classname = 'WPProgram'
  586.   objectname = '4OS2 Window'
  587.   msgtext = '4OS2 program file'
  588.   location = container
  589.   setup = 'EXENAME='||comDir||'\4OS2.EXE;'||,
  590.           'ICONFILE='||comDir||'\4OS2.ICO;'||,
  591.           'STARTUPDIR='||comDir||';'||,
  592.           'PROGTYPE=WINDOWABLEVIO;'||,
  593.           'OBJECTID='os2ExeId||';'
  594.   CALL DOCreateObject
  595.   
  596.   IF RESULT = 0 THEN DO
  597.     /* Create/update the help object */
  598.     classname = 'WPProgram'
  599.     objectname = '4OS2 Help'
  600.     msgtext = '4OS2 help file'
  601.     location = container
  602.     setup = 'EXENAME=VIEW.EXE;'||,
  603.             'PARAMETERS='||comDir||'\4OS2.INF;'||,
  604.             'PROGTYPE=PM;'||,
  605.             'OBJECTID='os2HelpId||';'
  606.     CALL DOCreateObject
  607.   END
  608. RETURN RESULT
  609.  
  610.  
  611. /****************************************************************************/
  612. CreateTCMDObjects:
  613.   /* Create/update the main executable */
  614.   classname = 'WPProgram'
  615.   objectname = 'Take Command'||'0d0A'x||'for OS/2'
  616.   msgtext = 'Take Command for OS/2 program file'
  617.   location = container
  618.   setup = 'EXENAME='||comDir||'\TCMDOS2.EXE;'||,
  619.           'STARTUPDIR='||comDir||';'||,
  620.           'PROGTYPE=PM;'||,
  621.           'OBJECTID='tcmdExeId||';'
  622.   CALL DOCreateObject
  623.  
  624.   IF RESULT = 0 THEN DO
  625.     /* Create/update the help object */
  626.     classname = 'WPProgram'
  627.     objectname = 'Take Command'||'0d0A'x||'for OS/2 Help'
  628.     msgtext = 'Take Command for OS/2 help file'
  629.     location = container
  630.     setup = 'EXENAME=VIEW.EXE;'||,
  631.             'PARAMETERS='||comDir||'\TCMDOS2.INF;'||,
  632.             'PROGTYPE=PM;'||,
  633.             'OBJECTID='tcmdHelpId||';'
  634.     CALL DOCreateObject
  635.   END
  636.  
  637. RETURN RESULT
  638.  
  639.  
  640. /****************************************************************************/
  641. RemoveFolder:
  642.   /* Delete the folder */
  643.   msgtext = 'JP Software Command Processors folder'
  644.   object = jpFolder
  645.   
  646.   CALL DODestroyObject
  647.  
  648.   IF (RESULT = 0) THEN
  649.     holdRC = 0
  650.   ELSE  
  651.     holdRC = 1
  652.  
  653. RETURN holdRC
  654.  
  655.  
  656. /****************************************************************************/
  657. Remove4DOSObjects:
  658.   /* Delete the objects */
  659.   msgtext = '4DOS Window'
  660.   object = dosExeId
  661.   CALL DODestroyObject
  662.   holdRC = RESULT
  663.   
  664.   msgtext = '4DOS Help'
  665.   object = dosHelpId
  666.   CALL DODestroyObject
  667.  
  668.   IF (RESULT \= 0) | (holdRC \= 0) THEN
  669.     holdRC = 1
  670.  
  671. RETURN holdRC
  672.  
  673.  
  674. /****************************************************************************/
  675. Remove4OS2Objects:
  676.   /* Delete the objects */
  677.   msgtext = '4OS2 program file'
  678.   object = os2ExeId
  679.   CALL DODestroyObject
  680.   holdRC = RESULT
  681.   
  682.   msgtext = '4OS2 help file'
  683.   object = os2HelpId
  684.   CALL DODestroyObject
  685.  
  686.   IF (RESULT \= 0) | (holdRC \= 0) THEN
  687.     holdRC = 1
  688.  
  689. RETURN holdRC
  690.  
  691.  
  692. /****************************************************************************/
  693. RemoveTCMDObjects:
  694.   /* Delete the objects */
  695.   msgtext = 'Take Command for OS/2 program file'
  696.   object = tcmdExeId
  697.   CALL DODestroyObject
  698.   holdRC = RESULT
  699.   
  700.   msgtext = 'Take Command for OS/2 help file'
  701.   object = tcmdHelpId
  702.   CALL DODestroyObject
  703.  
  704.   IF (RESULT \= 0) | (holdRC \= 0) THEN
  705.     holdRC = 1
  706.  
  707. RETURN holdRC
  708.  
  709.  
  710. /****************************************************************************/
  711. DOCreateObject:
  712.   SAY ''
  713.   CALL charout, 'Creating/updating object:  ' msgtext
  714.   rc = SysCreateObject(classname, objectname, location, setup, 'U')
  715.   IF rc <> 0 THEN DO
  716.     CALL charout ,'... OK!'
  717.     objRC = 0
  718.   END
  719.   ELSE DO
  720.     CALL charout ,'... ERROR #'rc
  721.     objRC = 1
  722.   END
  723.  
  724.   SAY '';
  725. RETURN objRC
  726.  
  727.  
  728. /****************************************************************************/
  729. DODestroyObject:
  730.   SAY ''
  731.   CALL charout, 'Removing object:  ' msgtext
  732.   rc = SysDestroyObject(object)
  733.   IF rc <> 0 THEN DO
  734.     CALL charout ,'... OK!'
  735.     objRC = 0
  736.   END
  737.   ELSE DO
  738.     CALL charout ,'... ERROR #'rc
  739.     objRC = 1
  740.   END
  741.  
  742.   SAY '';
  743. RETURN objRC
  744.  
  745.  
  746. /****************************************************************************/
  747. ArgError:
  748.   SAY ''
  749.   SAY 'This program can only be run by the JP Software INSTALL program.'
  750.   SAY 'It will not work if you attempt to execute it manually.'
  751. RETURN
  752.  
  753.  
  754. /****************************************************************************/
  755. UCase:
  756.   PARSE UPPER ARG ucReturn
  757. RETURN ucReturn
  758.  
  759.