home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 December / WIN95_DEC_1996_1.ISO / vrml / VOYAGER.EXE / RL2B12 / SETUP.RUL < prev    next >
Text File  |  1995-07-12  |  14KB  |  411 lines

  1. /*----------------------------------------------------------------------------*\
  2.  *
  3.  *  IIIIIII SSSSSS
  4.  *    II    SS                          InstallSHIELD (R)
  5.  *    II    SSSSSS          (c) 1990-1995, Stirling Technologies, Inc.
  6.  *    II        SS                     All Rights Reserved.
  7.  *  IIIIIII SSSSSS
  8.  *
  9.  *
  10.  *  This source code is intended as a supplement to Stirling Technologies,
  11.  *  Inc., product documentation.  Refer to your Stirling Technologies, Inc.,
  12.  *  product documentation for more detailed information.
  13.  *
  14.  *
  15.  *    File Name:  SETUP.RUL
  16.  *
  17.  *  Description:  InstallSHIELD SDK Edition Template One script.
  18.  *
  19.  *
  20.  *
  21.  *
  22.  *       Author:  Stirling Technologies, Inc.       Date:  2-4-95
  23.  *
  24.  *     Comments:  This template script performs a basic installation to a
  25.  *                Windows 95 or Windows NT platform.  The installation
  26.  *                includes components: Application Program Files, Sample and
  27.  *                Template Files, Online Help Files, and Multimedia Tutorial
  28.  *                Files.  With minor modifications, this template can be
  29.  *                adapted to create new, customized installations.
  30.  *
  31.  *                There maybe small differences between this script and the
  32.  *                script shown in the on-line User's Guide
  33.  *
  34.  *
  35. \*----------------------------------------------------------------------------*/
  36.  
  37.  
  38.  
  39. // Size of components.
  40. //#define SIZE_REQ_SAMPLES          82000
  41. //#define SIZE_REQ_TEMPLATES         2000
  42. #define SIZE_REQ_PROGRAM        3753707
  43.  
  44. #define APP_NAME                "Reality Lab"
  45. #define PROGRAM_GROUP_NAME      "Reality Lab"
  46. #define APPBASE_PATH            "RM\\RealityLab\\"
  47. #define COMPANY_NAME            "Microsoft Rendermorphics"
  48. #define PRODUCT_NAME            "Reality Lab"
  49. #define PRODUCT_VERSION         "2.0 Beta 11"
  50. #define PRODUCT_KEY             ""
  51. #define UNINSTALL_KEY           "RealityLabV2B11"
  52. #define APPBASE_DIR95           ""
  53. #define BASE_REGISTRYNT         "Software\\Microsoft\\Windows NT\\CurrentVersion\\App Paths\\"
  54. #define BASE_REGISTRY95         "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"
  55.  
  56. #define STR_COMPLETE95 "by selecting the program icon in the Programs menu.\n\n"
  57. #define STR_COMPLETENT "by selecting the program icon in the program group.\n\n"
  58.  
  59. declare
  60.  
  61.         // Global variable declarations.
  62.         STRING  svGrp, szMsg, szFileSet, szTitle, szAppPath, szAppSharedDir;
  63.         STRING  szProgram, szTemp, svUninstLogFile, szRegKey;
  64.         STRING  svMainDirectory[ _MAX_STRING ];
  65.     STRING    svWinSystem, svWinPath;
  66.         BOOL    bSpaceOk, bReshowSetupType;
  67.         NUMBER  nResult, nStatusId, nType;
  68.  
  69.         BOOL    bIncludeProgram, bIncludeSamples, bIncludeHelp;
  70.         BOOL    bWinNT;
  71.  
  72.         // Function declarations.
  73.         prototype SetupScreen();
  74.         prototype CheckRequirements();
  75.         prototype CheckSpaceRequirements( string );
  76.         prototype CreateRegDBEntries();
  77.  
  78. program
  79.  
  80. StartHere:
  81.         Disable( BACKGROUND );
  82.  
  83.         // Set up the installation screen.
  84.         SetupScreen();
  85.  
  86.         // Set installation info., which is required for registry entries.
  87.         InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
  88.  
  89. // Create a Welcome dialog.
  90. WelcomeDlg:
  91.         Disable( BACKBUTTON );
  92.         Welcome( "Welcome", 0 );
  93.         Enable( BACKBUTTON );
  94.  
  95.         // Test target system proper configuration.
  96.         CheckRequirements();
  97.  
  98.         // Ask user for a destination location for the installation.
  99. GetTargetDirectory:
  100.  
  101.         svMainDirectory = TARGETDISK ^ APPBASE_DIR95 ^ APPBASE_PATH;
  102.  
  103.         szMsg = "";
  104.         if ( AskDestPath( "Choose Destination Location", szMsg,
  105.                           svMainDirectory, 0 ) = BACK ) then
  106.            goto WelcomeDlg;
  107.         endif;
  108.  
  109.         szAppSharedDir = svMainDirectory ^ "System";
  110.     
  111.     GetEnvVar("WINDIR",svWinPath);
  112.     if ( ExistsDir(svWinPath + "\\system")) then svWinSystem = svWinPath + "\\system"; endif;
  113.      MessageBox(svWinSystem , INFORMATION );
  114.  
  115.         nType = TYPICAL;
  116.  
  117. FileTransferSetup:
  118.  
  119.         // Prepare InstallSHIELD to record deinstallation information.
  120.         bSpaceOk = CheckSpaceRequirements( svMainDirectory );
  121.     
  122.         DeinstallStart( svMainDirectory, svUninstLogFile, UNINSTALL_KEY, 0 );
  123.         RegDBSetItem( REGDB_UNINSTALL_NAME, APP_NAME );
  124.  
  125.         // Set registry App Paths key information for the main application.
  126.         szAppPath = svMainDirectory ^ "PROGRAM" + ";" + szAppSharedDir;
  127.         RegDBSetItem( REGDB_APPPATH, szAppPath );
  128.         szProgram = svMainDirectory ^ "PROGRAM\\designer.exe";
  129.         RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  130.  
  131.         // Define the "General" file set.
  132.         szFileSet = "General";
  133.  
  134.         FileSetBeginDefine( szFileSet );
  135.  
  136.           SetStatusWindow( -1, "Copying program files..." );
  137.  
  138.           // Always copy README & related files, located at
  139.           // the root level in the DATA.Z library file.
  140.         //TARGETDIR = svMainDirectory;
  141.         //CompressGet( "data.z", "*.*", INCLUDE_SUBDIR );
  142.  
  143.         TARGETDIR = svWinSystem;
  144.         CompressGet( "dll.z", "*.*", INCLUDE_SUBDIR );
  145.  
  146.         FileSetEndDefine( szFileSet );
  147.  
  148. DoFileTransfer:
  149.         // Set up progress indicator and information gauge.
  150.         Enable( STATUSDLG );
  151.         StatusUpdate( ON, 90 );
  152.  
  153.         // Perform the file set.
  154.         nResult = FileSetPerformEz( szFileSet, 0 );
  155.  
  156.         switch (nResult)
  157.  
  158.         case FS_DONE: // Successful completion.
  159.  
  160.         case FS_CREATEDIR: // Create directory error.
  161.              MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
  162.                          "Please check write access to this directory.", SEVERE );
  163.              abort;
  164.  
  165.         default: // Group all other errors under default label.
  166.              NumToStr( szTemp, nResult );
  167.              MessageBox( "General file transfer error."+
  168.                           "Please check your target location and try again."+
  169.                           "\n\n Error Number:"+szTemp, SEVERE );
  170.  
  171.              abort;
  172.         endswitch;
  173.  
  174. SetRegistryEntries:
  175.  
  176.         CreateRegDBEntries( );
  177.  
  178.         Delay(2);
  179.         Disable( FEEDBACK_FULL );
  180.         Disable( STATUSDLG );
  181.  
  182.         // Create program groups (folders) and icons.
  183.  
  184.  
  185.         // Announce setup complete and offer to read README file.
  186.  
  187.         SetStatusWindow( 100, "Installation complete." );
  188.  
  189.            MessageBox( szMsg, INFORMATION );
  190.  
  191.         exit;
  192.  
  193.  
  194. /*---------------------------------------------------------------------------*\
  195.  *
  196.  * Function:  SetupScreen
  197.  *
  198.  *  Purpose:  This function will set up the screen look.  This includes
  199.  *            colors, fonts, text to be displayed, etc.
  200.  *
  201.  *
  202.  *    Input:
  203.  *
  204.  *  Returns:
  205.  *
  206.  * Comments:
  207. \*---------------------------------------------------------------------------*/
  208.  
  209. function SetupScreen()
  210.         begin
  211.  
  212.           Enable( INDVFILESTATUS );
  213.  
  214.           SetTitle( APP_NAME + " Setup", 28, WHITE );
  215.  
  216.           SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
  217.  
  218.           Enable( BACKGROUND );
  219.  
  220.         end;
  221.  
  222.  
  223. /*---------------------------------------------------------------------------*\
  224.  *
  225.  * Function:  CheckRequirements
  226.  *
  227.  *  Purpose:  This function will check all minimum requirements for the
  228.  *            application being installed.  If any fail, then the user
  229.  *            is informed and the installation is terminated.
  230.  *
  231.  *
  232.  *    Input:
  233.  *
  234.  *  Returns:
  235.  *
  236.  * Comments:
  237. \*---------------------------------------------------------------------------*/
  238.  
  239. function CheckRequirements()
  240.           number  nvDx, nvDy;
  241.           number nvResult;
  242.           STRING szResult;
  243.         begin
  244.  
  245.           // Determine if target system uses NT or Windows 95.
  246.           GetSystemInfo( WINMAJOR, nvResult, szResult );
  247.           bWinNT = TRUE;
  248.           if (nvResult = 4) then
  249.              bWinNT = FALSE; // Running Windows 95.
  250.           endif;
  251.  
  252.           // Check screen resolution.
  253.           GetExtents( nvDx, nvDy );
  254.           if (nvDy < 480) then
  255.              MessageBox( "This program requires VGA or better resolution.", WARNING );
  256.              exit;
  257.           endif;
  258.  
  259.         end;
  260.  
  261. /*---------------------------------------------------------------------------*\
  262.  *
  263.  * Function:  CheckSpaceRequirements
  264.  *
  265.  *  Purpose:  This function will check space requirements based on the
  266.  *            elements being installed.
  267.  *
  268.  *    Input:
  269.  *
  270.  *  Returns:
  271.  *
  272.  * Comments:
  273. \*---------------------------------------------------------------------------*/
  274.  
  275. function CheckSpaceRequirements( szDir )
  276.           number  nSizeRequired;
  277.         begin
  278.  
  279.           nSizeRequired = 0;
  280.  
  281.             nSizeRequired = SIZE_REQ_PROGRAM;
  282.  
  283.           // Check space on target drive.
  284.           bSpaceOk = TRUE;
  285.           if (GetDiskSpace( szDir ) < nSizeRequired) then
  286.              szMsg = "There is not enough space available on the disk\n" +
  287.                      "'" + svMainDirectory + "' \n" +
  288.                      "Please free up some space or change the target location\n" +
  289.                      "to a different disk";
  290.              MessageBeep(0);
  291.              MessageBox( szMsg, WARNING );
  292.              bSpaceOk = FALSE;
  293.           endif;
  294.  
  295.           return bSpaceOk;
  296.         end;
  297.  
  298.  
  299. /*---------------------------------------------------------------------------*\
  300.  *
  301.  * Function:  CreateRegDBEntries
  302.  *
  303.  *  Purpose:  This function will create necessary keys and values for
  304.  *            the sample program.
  305.  *
  306.  *    Input:
  307.  *
  308.  *  Returns:
  309.  *
  310.  * Comments:
  311. \*---------------------------------------------------------------------------*/
  312.  
  313. function CreateRegDBEntries()
  314.         string szKey[255], szValue, szDemo, szProgram;
  315. begin
  316.  
  317.         RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
  318.  
  319.         // Create PRODUCT_KEY key.
  320.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  321.                 PRODUCT_VERSION + "\\" + "DESIGNER";
  322.         RegDBCreateKeyEx( szKey, "" );
  323.  
  324.         RegDBSetKeyValueEx( szKey, "Template", REGDB_STRING, "good.tpl", -1 );
  325.         RegDBSetKeyValueEx( szKey, "TemplatePath", REGDB_STRING, svMainDirectory ^ "TEMPLATE", -1 );
  326.         RegDBSetKeyValueEx( szKey, "x",  REGDB_NUMBER, "2", -1 );
  327.         RegDBSetKeyValueEx( szKey, "y",  REGDB_NUMBER, "3", -1 );
  328.         RegDBSetKeyValueEx( szKey, "dx", REGDB_NUMBER, "637", -1 );
  329.         RegDBSetKeyValueEx( szKey, "dy", REGDB_NUMBER, "448", -1 );
  330.         RegDBSetKeyValueEx( szKey, "LargeDraw", REGDB_NUMBER, "1", -1 );
  331.         RegDBSetKeyValueEx( szKey, "PopupMenu", REGDB_NUMBER, "1", -1 );
  332.         RegDBSetKeyValueEx( szKey, "NoPopup", REGDB_NUMBER, "1", -1 );
  333.         RegDBSetKeyValueEx( szKey, "StartDialogValue", REGDB_NUMBER, "111", -1 );
  334.         RegDBSetKeyValueEx( szKey, "TimeVisible", REGDB_NUMBER, "0", -1 );
  335.  
  336.         if (bIncludeSamples) then
  337.            // Create "DEMOS" key.
  338.            szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  339.                    PRODUCT_VERSION + "\\" + "DEMOS";
  340.            RegDBCreateKeyEx( szKey, "" );
  341.  
  342.            szDemo    = svMainDirectory ^ "SAMPLES\\TECH.DBD";
  343.            szProgram = svMainDirectory ^ "PROGRAM\\DEMO.EXE";
  344.            RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, szDemo, -1 );
  345.  
  346.            szDemo    = svMainDirectory ^ "SAMPLES\\2MINUTE.DBD";
  347.            RegDBSetKeyValueEx( szKey, "path1", REGDB_STRING, szDemo, -1 );
  348.            RegDBSetKeyValueEx( szKey, "tour",  REGDB_STRING, szDemo, -1 );
  349.  
  350.            RegDBSetKeyValueEx( szKey, "exe",    REGDB_STRING, szProgram, -1 );
  351.            RegDBSetKeyValueEx( szKey, "active", REGDB_STRING, "Play", -1 );
  352.  
  353.         endif;
  354.  
  355.         // Create "HELPMENU" key.
  356.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  357.                 PRODUCT_VERSION + "\\" + "HELPMENU";
  358.         RegDBCreateKeyEx( szKey, "" );
  359.  
  360.         RegDBSetKeyValueEx( szKey, "MaxNum", REGDB_NUMBER, "1", -1 );
  361.  
  362.         RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, svMainDirectory ^ "README.TXT", -1 );
  363.         RegDBSetKeyValueEx( szKey, "exe0", REGDB_STRING, "NOTEPAD.EXE", -1 );
  364.         RegDBSetKeyValueEx( szKey, "active0", REGDB_STRING, "Read Me", -1 );
  365.  
  366.         // Create "MRU" key.
  367.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  368.                 PRODUCT_VERSION + "\\" + "MRU";
  369.         RegDBCreateKeyEx( szKey, "" );
  370.  
  371.         szDemo = svMainDirectory ^ "SAMPLES\\2MINUTE.DBD";
  372.         RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, szDemo, -1 );
  373.  
  374.         // Create "SceneEditor" key.
  375.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  376.                 PRODUCT_VERSION + "\\" + "SceneEditor";
  377.         RegDBCreateKeyEx( szKey, "" );
  378.  
  379.         RegDBSetKeyValueEx( szKey, "x",  REGDB_NUMBER, "453", -1 );
  380.         RegDBSetKeyValueEx( szKey, "y",  REGDB_NUMBER, "2", -1 );
  381.         RegDBSetKeyValueEx( szKey, "Visible",  REGDB_NUMBER, "1", -1 );
  382.  
  383.         // Create "ToolPalette" key.
  384.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  385.                 PRODUCT_VERSION + "\\" + "ToolPalette";
  386.         RegDBCreateKeyEx( szKey, "" );
  387.  
  388.         RegDBSetKeyValueEx( szKey, "x",  REGDB_NUMBER, "509", -1 );
  389.         RegDBSetKeyValueEx( szKey, "y",  REGDB_NUMBER, "155", -1 );
  390.         RegDBSetKeyValueEx( szKey, "Visible",  REGDB_NUMBER, "1", -1 );
  391.  
  392.         // Create "AlignPalette" key.
  393.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  394.                 PRODUCT_VERSION + "\\" + "AlignPalette";
  395.         RegDBCreateKeyEx( szKey, "" );
  396.  
  397.         RegDBSetKeyValueEx( szKey, "Visible",  REGDB_NUMBER, "0", -1 );
  398.  
  399.         // Create "Controller" key.
  400.         szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
  401.                 PRODUCT_VERSION + "\\" + "Controller";
  402.         RegDBCreateKeyEx( szKey, "" );
  403.  
  404.         RegDBSetKeyValueEx( szKey, "x",  REGDB_NUMBER, "420", -1 );
  405.         RegDBSetKeyValueEx( szKey, "y",  REGDB_NUMBER, "231", -1 );
  406.         RegDBSetKeyValueEx( szKey, "Visible",  REGDB_NUMBER, "1", -1 );
  407.  
  408. end;
  409.  
  410. 
  411.