home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / 4os2301.zip / JPOS2INS.CMD < prev    next >
OS/2 REXX Batch file  |  1998-02-02  |  22KB  |  787 lines

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