home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------*\
- *
- * IIIIIII SSSSSS
- * II SS InstallShield (R)
- * II SSSSSS (c) 1990-1996, Stirling Technologies, Inc.
- * II SS All Rights Reserved.
- * IIIIIII SSSSSS
- *
- *
- * File Name: SETUP.RUL
- *
- * Description: InstallShield Professional Edition
- * 32-bit script.
- *
- *
- * Author: Diamond Ridge, Inc. Date: 2-8-97
- *
- * Comments:
- *
- *
- *
- \*----------------------------------------------------------------------------*/
-
- declare
-
- // Constant declarations.
- #define SPACE_REQUIRED 4500000 // Disk space in bytes.
- #define APP_NAME "CRADAbase"
- #define PROGRAM_FOLDER_NAME "CRADAbase"
- #define APPBASE_PATH "CRADAbase\\"
- #define APPBASE_PATH_WIN32S "CRADAbase\\"
- #define COMPANY_NAME "Diamond Ridge, Inc."
- #define PRODUCT_NAME "CRADAbase"
- #define PRODUCT_VERSION "1.0"
- #define DEINSTALL_KEY "CRADAbase"
- #define UNINSTALL_NAME "CRADAbase"
- #define PRODUCT_KEY "tucars.exe"
-
- // Global variable declarations.
- STRING svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
- STRING svTarget, szProgram, szParam, szTemp, szAppPath, svSite, svDUMName;
- BOOL bSpaceOk, bWinNT, bWin32s, bIsShellExplorer;
- NUMBER nResult;
- #include "sddialog.h"
-
- // Function declarations.
- prototype SetupScreen();
- prototype CheckRequirements();
-
- program
-
- StartHere:
- Disable( BACKGROUND );
-
- // Set installation info., which is required for registry entries.
- InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
-
- // Set up thr installation screen.
- SetupScreen();
- Enable( DIALOGCACHE );
-
-
- // Create a Welcome dialog.
- WelcomeDlg:
- Disable( BACKBUTTON );
- Welcome( "", 0 );
- Enable( BACKBUTTON );
-
- // Test target system for proper configuration.
- CheckRequirements();
-
-
- // Ask user for a destination location for the installation.--
- GetTargetDirectory:
- if (bWin32s) then
- svTarget = TARGETDISK ^ APPBASE_PATH_WIN32S;
- else
- svTarget = TARGETDISK ^ APPBASE_PATH;
- endif;
- if ( AskDestPath( "", szMsg,
- svTarget, 0 ) = 12 ) then
- goto WelcomeDlg;
- endif;
-
- // Perform space check of target drive.
- bSpaceOk = TRUE;
- if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
- szMsg = "There is not enough space available on the disk\n" +
- "'" + svTarget + "' \n" +
- "Please free up some space or change the target location\n" +
- "to a different disk";
- MessageBox( szMsg, WARNING );
- bSpaceOk = FALSE;
- endif;
-
- // If not enough space, ask user to try again.
- if (bSpaceOk = FALSE) goto GetTargetDirectory;
-
- // Set the App Paths key for the main program.
- szAppPath = svTarget ^ "PROGRAM";
- RegDBSetItem( REGDB_APPPATH, szAppPath );
- szProgram = svTarget ^ "PROGRAM\\tucars.exe";
- RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
-
- // Ask user for Site Code for database replication.
- GetSite:
- SetDialogTitle(DLG_ASK_TEXT, "Enter Site Code");
- if (AskText("Please enter the Site Code (used for database replication)","",svSite) = 12) then
- goto GetTargetDirectory;
- endif;
- if (svSite = "") goto GetSite;
-
- SetupFilesToTransfer:
- szFileSet = "General";
- TARGETDIR = svTarget;
-
- // Define the file set.
- FileSetBeginDefine( szFileSet );
-
- SetStatusWindow( -1, "Copying program files..." );
- CompressGet( "DATA.Z", "program\\*.*", INCLUDE_SUBDIR );
-
- SetStatusWindow( -1, "Copying TWAIN drivers..." );
- TARGETDIR = WINDIR;
- CompressGet( "DATA.Z", "twain\\*.*", INCLUDE_SUBDIR );
-
- SetStatusWindow( -1, "Copying system files..." );
- TARGETDIR = WINSYSDIR;
- CompressGet( "DATA.Z", "winsys\\*.*", INCLUDE_SUBDIR );
-
- FileSetEndDefine( szFileSet );
-
-
- TransferFiles:
- // Prepare InstallShield to record deinstallation information.
- DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
- RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
-
- // Set up progress indicator and information gauge.
- Disable( DIALOGCACHE );
- Enable( STATUSDLG );
-
- StatusUpdate( ON, 90 );
-
- // Perform the file set.
- SetStatusWindow( 0, "Copying program files..." );
- nResult = FileSetPerformEz( szFileSet, 0 );
-
- switch (nResult)
-
- case FS_DONE: // Successful completion.
-
- case FS_CREATEDIR: // Create directory error.
- MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
- "Please check write access to this directory.", SEVERE );
- exit;
-
- default: // Group all other errors under default label.
- NumToStr( szTemp, nResult );
- MessageBox( "General file transfer error."+
- "Please check your target location and try again."+
- "\n\n Error Number:"+szTemp +
- "\n Related File: "+ERRORFILENAME,
- SEVERE );
- exit;
- endswitch;
-
- Delay( 1 );
-
- // Create app subdirectories
- CreateDir(svTarget ^ "Database");
- CreateDir(svTarget ^ "Pictures");
- CreateDir(svTarget ^ "Reports");
- CreateDir(svTarget ^ "Repl");
- CreateDir(svTarget ^ "Repl\\Crada");
- CreateDir(svTarget ^ "Repl\\" + svSite);
-
- // Modify Autoexec.bat
- SetStatusWindow( -1, "Modifying startup files..." );
- BatchFileLoad("");
- BatchDeleteEx("SQLREMOTE",0);
- BatchAdd("SQLREMOTE", svTarget ^ "REPL", "PATH", AFTER);
- BatchFileSave("");
-
- // Modify site-specific info in CRADA.INI
- LongPathToShortPath(svTarget);
- WriteProfString(WINDIR ^ "CRADA.INI", "Account Information", "Site", svSite);
- WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "Database", svTarget ^ "Database");
- WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "Logo", svTarget ^ "Crada.bmp");
- WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "LocalPictures", svTarget ^ "Pictures");
- WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "Reports", svTarget ^ "Reports");
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "TUTransactionDir", "Crada");
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "DealerTransactionFiles", svSite + "\\*.*");
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "LocalDealerTransactionDir", svTarget ^ "Repl" ^ svSite);
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "LocalTUTransactionFiles", svTarget ^ "Repl\\Crada\\*.*");
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "FtpFromTUScript", "c:\\ftptu.txt");
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "IP", "ftp.etu.com");
- WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "FtpToTUScript", "c:\\ftp2tu.txt");
- WriteProfString(WINDIR ^ "CRADA.INI", "TUADS Car Scheduling", "Program", svTarget ^ svDUMName);
-
- // Create program folders and icons.
- InstallProgramItems:
- SetStatusWindow( 95, "Creating Program Folder and Icons...." );
-
- AppCommand( PROGMAN, CMD_RESTORE );
- svFolder = PROGRAM_FOLDER_NAME;
- CreateProgramFolder( svFolder );
- ShowProgramFolder( svFolder, 0 );
- LongPathToShortPath( svTarget );
- Delay(1);
-
- szProgram = svTarget ^ "TUCARS.EXE";
- AddFolderIcon( svFolder, APP_NAME, szProgram,
- svTarget,
- "", 0, "", REPLACE );
- Delay( 1 );
-
- szProgram = svTarget ^ svDUMName;
- AddFolderIcon( svFolder, "CRADAbase Update Module", szProgram,
- svTarget,
- "", 0, "", REPLACE );
- Delay( 1 );
-
- szProgram = svTarget ^ "TUSEND.EXE";
- AddFolderIcon( svFolder, "CRADAbase AutoSender", szProgram,
- svTarget,
- "", 0, "", REPLACE );
- Delay( 1 );
-
- // Global variable UNINST stores the name and location of the
- // uninstaller file.
- szProgram = UNINST;
- LongPathToShortPath( szProgram );
- LongPathToShortPath( svUninstLogFile );
- szProgram = szProgram + " -f" + svUninstLogFile;
- AddFolderIcon( svFolder, "UnInstall CRADAbase", szProgram,
- WINDIR, "", 0, "", REPLACE );
-
- Disable( STATUSDLG );
- Delay( 1 );
-
- // Announce setup complete and offer to read README file.e
- FinalInstallProcess:
- SetStatusWindow( 100, "Installation complete." );
-
- SdFinishReboot ("", "", SYS_BOOTMACHINE, "", 0);
-
- // szMsg = "Setup is complete. You may run the installed program "+
- // "by double-clicking on the program icon.";
- // MessageBox( szMsg, INFORMATION );
-
- exit;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: SetupScreen
- *
- * Purpose: This function will set up the screen look. This includes
- * colors, fonts, text to be displayed, etc.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
- function SetupScreen()
- number nDx, nDy;
- begin
- GetExtents( nDx, nDy );
-
- Enable( FULLWINDOWMODE );
- Enable( INDVFILESTATUS );
- Enable( BITMAP256COLORS );
-
- SetTitle( "Installing " + APP_NAME, 24, WHITE );
-
- SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
- SetColor( STATUSBAR, BLUE ); // Bright blue.
- SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
-
- Enable( BACKGROUND );
-
- Delay( 1 );
-
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckRequirements
- *
- * Purpose: This function will check all minimum requirements for the
- * application being installed. If any fail, then the user
- * is informed and the installation is terminated.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
- function CheckRequirements()
- number nvDx, nvDy;
- number nvResult;
- STRING svResult;
-
- begin
-
- // Check screen resolution.
- GetExtents( nvDx, nvDy );
- if (nvDy < 480) then
- MessageBox( "This program requires VGA or better resolution.", WARNING );
- exit;
- endif;
-
- // Determine the target system's operating system.
- GetSystemInfo( OS, nvResult, svResult );
- bWinNT = FALSE;
- bWin32s = FALSE;
- bIsShellExplorer = FALSE;
-
- // Set filename of DUM for Win 3.x vs. Win 95/NT
- if (nvResult = IS_WINDOWS) then
- svDUMName = "DUM.EXE";
- else
- svDUMName = "DUM32.EXE";
- endif;
-
- if (nvResult = IS_WINDOWSNT) then
- bWinNT = TRUE; // Running Windows NT.
-
- // Check to see if NT is using EXPLORER Shell
- if( QueryShellMgr( svResult ) = 0 ) then
- if( StrCompare( svResult, "EXPLORER.EXE" ) = 0 ) then
- bIsShellExplorer = TRUE;
- endif;
- endif;
-
- elseif (nvResult = IS_WIN32S) then
- bWin32s = TRUE; // Running Win32s.
- endif;
-
- end;
-
- #include "sddialog.rul"
-