home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv7.zip / VACPP / IBMCPP / smarts / SCRIPTS / VBSCR.CMD < prev    next >
OS/2 REXX Batch file  |  1995-06-02  |  5KB  |  147 lines

  1. /*REXX*/
  2.  
  3. /*   VBSCR.CMD  Project Smarts install script for Visual Builder project
  4.  *
  5.  *   Licensed Materials - Property of IBM
  6.  *
  7.  *   "Restricted Materials of IBM"
  8.  *
  9.  *   IBM WorkFrame
  10.  *
  11.  *   (C) Copyright IBM Corp. 1995. All Rights Reserved.
  12.  *
  13.  *   US Government Users Restricted Rights - Use, duplication or
  14.  *   disclosure restricted by GSA ADP Schedule Contract with
  15.  *   IBM Corp.
  16.  *
  17.  */
  18.  
  19.  
  20. /* Initialize - use a global stem variable. */
  21. stem = "stem"
  22. RC_OK     = 0
  23. RC_CANCEL = 95
  24.  
  25.  
  26. /* Open the installation console. */
  27. rc = IwfOpenConsole(stem);
  28.  
  29.  
  30. /* Load the REXX utility functions. */
  31. rc = RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs');
  32. rc = SysLoadFuncs();
  33.  
  34.  
  35. /* Extract the passed parameters. */
  36. if (Arg() <> 2) Then
  37.    call Abort("Error in parameter list.");
  38. Parse Arg Proj,Src;
  39.  
  40.  
  41. /* Initialize the progress, status, and log. */
  42. stem.usPercent     = 0
  43. stem.pszStatusText = "Initializing..."
  44. rc = IwfUpdateConsoleProgress(stem);
  45. rc = IwfUpdateConsoleStatus(stem);
  46. SAY "Initializing the Project Smarts install..."
  47. SAY " "
  48.  
  49. /* Present disclaimers. */
  50. stem.usPercent     = 10
  51. stem.pszStatusText = "Presenting disclaimers..."
  52. rc = IwfUpdateConsoleProgress(stem);
  53. rc = IwfUpdateConsoleStatus(stem);
  54. line1 = 'DISCLAIMER OF WARRANTIES.  The code that will be installed is '
  55. line2 = 'template code created by IBM Corporation. This code is not '
  56. line3 = 'part of any standard or IBM product and is provided to you solely '
  57. line4 = 'for  the purpose of assisting you in the development of your '
  58. line5 = 'applications.  The code is provided "AS IS", without '
  59. line6 = 'warranty of any kind.  IBM shall not be liable for any damages '
  60. line7 = 'arising out of your use of the sample code, even if they have been '
  61. line8 = 'advised of the possibility of such damages.'
  62. SAY line1||line2||line3||line4||line5||line6||line7||line8
  63. SAY " "
  64.  
  65. /* Query the target location for the install. */
  66. stem.usPercent     = 30
  67. stem.pszStatusText = "Querying the install location..."
  68. rc = IwfUpdateConsoleProgress(stem);
  69. rc = IwfUpdateConsoleStatus(stem);
  70. SAY "Enter the project name, target directory, and folder for the installation."
  71. /* Set defaults for Location dialog */
  72. env='OS2ENVIRONMENT';                  /* Default target directory */
  73. tmploc = VALUE('tmp',,env)             /* is on TMP variable dir   */  
  74. tmploc = STRIP(tmploc,Trailing,'\');   /* Strip any backslashes at end of path */
  75. Locn = tmploc||'\vbprj';
  76. stem.pszTargetProject   = Proj
  77. stem.pszTargetDirectory = Locn
  78. stem.pszTargetFolder    = "Desktop"
  79. do until (rc = RC_OK)
  80.    rc = IwfQueryLocation(stem);
  81.    if (rc  = RC_CANCEL) then call Cancel
  82.    else
  83.    if (rc <> RC_OK) then call Abort("Error querying target information.");
  84. end
  85.  
  86.  
  87. /* Copy the parts file over. */
  88. stem.usPercent     = 50
  89. stem.pszStatusText = "Copying files, with substitution."
  90. rc = IwfUpdateConsoleProgress(stem);
  91. rc = IwfUpdateConsoleStatus(stem);
  92. SAY "The project source files in" Src "are being copied to" stem.pszTargetDirectory"."
  93. stem.pszSourceFileMask = Src;
  94. copy Src'\* ' stem.pszTargetDirectory
  95. if (rc <> RC_OK) then call Abort("Error copying files.");
  96.  
  97.  
  98. /* Create and set the WorkFrame project. */
  99. stem.usPercent     = 80;
  100. stem.pszStatusText = "Creating the Workframe/2 project.";
  101. rc = IwfUpdateConsoleProgress(stem);
  102. rc = IwfUpdateConsoleStatus(stem);
  103. SAY "The project will be created in "stem.pszTargetFolder;
  104. pszTarDir = stem.pszTargetDirectory;
  105. /* Get the path of the shell projects */
  106. ShellPath = VALUE('CPPMAIN',,env);   /* on CPPMAIN variable path */
  107. if ShellPath='' then call Abort("Error obtaining CPPMAIN path.");
  108. ShellPath = ShellPath'\smarts\projects';
  109. stem.pszSourceProject = ShellPath'\VB'
  110. stem.pszTargetProjectSetup = 'TARGETNAME=VBMain.exe;MAKEFILENAME=VBMain.mak;PAMLOCATION:IWFBPAM='pszTarDir';PAMDEFAULT:IWFBPAM='pszTarDir';INHERITLIST=<CPPDFTPRJ>;TITLE='stem.pszTargetProject';'
  111. SAY stem.pszTargetProjectSetup;
  112. rc = IwfCreateProjectFromProject(stem)
  113. if (rc <> RC_OK) then call Abort("Error creating project.");
  114.  
  115.  
  116. /* Done! */
  117. stem.usPercent     = 100
  118. stem.pszStatusText = "Installation successful."
  119. rc = IwfUpdateConsoleProgress(stem);
  120. rc = IwfUpdateConsoleStatus(stem);
  121. SAY "The installation is complete and was successful."
  122. rc = RxMessageBox("The WorkFrame project has been created.", "Done!", "OK", "Information");
  123.  
  124. /* We are done. */
  125. call Done(0);
  126.  
  127.  
  128. Cancel:
  129. rcCancel = RxMessageBox("Do you really want to cancel?", , "YesNo", "Query")
  130. if (rcCancel = 6) Then
  131.    call Done(8)
  132. return
  133.  
  134. Abort:
  135. parse arg abortMessage
  136. rcAbort = RxMessageBox(abortMessage, , "OK", "Error")
  137. call Done(16)
  138.  
  139. Done:
  140. arg exitRc
  141. /* Close the installation console. */
  142. rcDone = IwfCloseConsole(stem);
  143. exit(exitRc)
  144.  
  145.  
  146.  
  147.