/*----------------------------------------------------------------------------*\ * * IIIIIII SSSSSS * II SS InstallShield (R) * II SSSSSS (c) 1990-1995, Stirling Technologies, Inc. * II SS All Rights Reserved. * IIIIIII SSSSSS * * * This code is intended as a supplement to InstallShield documentation * and is provided AS IS. * * * File Name: SETUP.RUL * * Description: InstallShield Professional Edition * 32-bit Template One script. * * * Author: Stirling Technologies, Inc. Date: 9-2-95 * * Comments: This template script performs a basic installation to a * Windows 95 or Windows NT platform. The installation * includes components: Application Program Files, Sample and * Template Files, Online Help Files, and Multimedia Tutorial * Files. With minor modifications, this template can be * adapted to create new, customized installations. * * * \*----------------------------------------------------------------------------*/ declare // includes #include "sddialog.h" // Constant declarations. #define SPACE_REQUIRED 17000000 // Disk space in bytes. #define APP_NAME "Linguist" #define PROGRAM_FOLDER_NAME "Linguist" #define APPBASE_PATH "Program Files\\PT Atlantis Programma Prima\\" #define APPBASE_PATH_WIN32S "Programf\\PTAPP\\" #define COMPANY_NAME "PT Atlantis Programma Prima" #define PRODUCT_NAME "Linguist" #define PRODUCT_VERSION "1.0" #define DEINSTALL_KEY "LinguistDeinstKey" #define UNINSTALL_NAME "Linguist" #define PRODUCT_KEY "Linguist.exe" // Global variable declarations. STRING svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile; STRING svTarget, szProgram, szParam, szTemp, svFileName,szAppPath,szQuestion; STRING svName,szName,svCompany,svSerial,szCompany,szSerial,szInsertLine; STRING szDir, svSubA, svSubB, svSubC, svSubD, svSubE,szIniFileName,szLicenseFile; STRING srcdir1,srcdir2,srcdir3,tgtdir2,tgtdir3; BOOL bSpaceOk, bWinNT, bWin32s, bWin95; NUMBER nResult, nReturn, nvarA, nvarB, nvarC, nvarD, nvarE; NUMBER dllfound, dll42found, dllcrfound; // 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( " Welcome To Linguist", 0 ); nReturn = NO; while(nReturn = NO) // Create a License Agreement szLicenseFile=SRCDIR+"License.Txt"; szTitle="License Agreement"; szMsg = "Please read the following license agreement. Use"+ "the scroll bar to view the rest of this agreement"; szQuestion = "Do you accept all of the terms of the preceding license"+ " agreement? If so, \nclick on the yes push button."+ "If you select no setup will close."; // Disable the back button and display the license ageement Disable(BACKBUTTON); SdLicense(szTitle,szMsg,szQuestion,szLicenseFile); // Get user registration information szTitle = "Registration"; szMsg = "Please Register Your Copy of Linguist Now"; svName = ""; svCompany = ""; svSerial = ""; SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial); szTitle = "Registration Confirmation"; szName = svName; szCompany = svCompany; szSerial = svSerial; nReturn = SdConfirmRegistration(szTitle, szName, szCompany, szSerial, STYLE_NORMAL); endwhile; nReturn = NO; if (StrLength(svSerial) != 15) then MessageBox("Registration Number Wrong!",SEVERE); exit; endif; StrSub(svSubA,svSerial,5,1); StrSub(svSubB,svSerial,6,1); StrSub(svSubC,svSerial,7,1); StrSub(svSubD,svSerial,8,1); StrSub(svSubE,svSerial,9,1); StrToNum(nvarA,svSubA); StrToNum(nvarB,svSubB); StrToNum(nvarC,svSubC); StrToNum(nvarD,svSubD); StrToNum(nvarE,svSubE); if ((nvarA+nvarB+nvarC+nvarD+nvarE) != 28) then MessageBox("Registration Number Wrong!", SEVERE); exit; endif; 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( "Destination Path", szMsg, svTarget, 0 ) = 12 ) then goto WelcomeDlg; else //svTarget=svTarget^"\\"; 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; RegDBSetItem( REGDB_APPPATH, szAppPath ); szProgram = svTarget; RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram ); svFolder="Linguist"; SetupFilesToTransfer: szFileSet = "General"; TARGETDIR = svTarget^svFolder; SRCDIR=SRCDIR^"Linguist"; srcdir2=SRCDIR^"\\Dictionaries"; srcdir3=SRCDIR^"\\Program"; tgtdir2=TARGETDIR^"\\Dictionaries\\"; tgtdir3=TARGETDIR^"\\Program"; //CreateDir(svFolder); // Define the file set. // FileSetBeginDefine( szFileSet ); //SetStatusWindow( -1, "Copying program files..." ); //MessageBox(SRCDIR,INFORMATION); //MessageBox(TARGETDIR,INFORMATION); // CopyFile( "*.txt", "*.txt"); //FileSetRoot(szFileSet,SRCDIR^"Dictionaries"); //TARGETDIR=TARGETDIR^"Dictionaries"; //MessageBox(SRCDIR,INFORMATION); // MessageBox(TARGETDIR,INFORMATION); // CopyFile( "*.idx","*.idx"); // CopyFile( "*.dic","*.dic"); // FileSetRoot(szFileSet,srcdir3); // TARGETDIR=tgtdir3; //MessageBox(srcdir3,INFORMATION); // MessageBox(TARGETDIR,INFORMATION); // CopyFile("*.*","*.*"); // FileSetRoot(szFileSet,""); // 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 ); CreateDir(svTarget); CreateDir(svTarget^"Linguist"); CreateDir(svTarget^"Linguist\\Program"); CreateDir(svTarget^"Linguist\\Dictionaries"); StatusUpdate( ON, 90 ); // Perform the file set. SetStatusWindow( 0, "Copying program files..." ); CopyFile( "*.txt", "*.txt"); SRCDIR = SRCDIR^"Dictionaries"; TARGETDIR=tgtdir2; CopyFile( "*.idx", "*.idx"); CopyFile( "*.dic", "*.dic"); SRCDIR=srcdir3; TARGETDIR=tgtdir3; CopyFile( "*.*", "*.*"); //CopyFile( "*.idx","*.idx"); //CopyFile( "*.dic","*.dic"); // 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); SRCDIR = svTarget ^ "Linguist\\Program"; szIniFileName=SRCDIR^"\\linguist.ini"; szInsertLine=svTarget ^ "\\Linguist\\Dictionaries\\Kamus1.dic"; WriteProfString(szIniFileName,"Dictionaries","Kamus1",szInsertLine); szInsertLine=svTarget ^ "\\Linguist\\Dictionaries\\Kamus2.dic"; WriteProfString(szIniFileName,"Dictionaries","Kamus2",szInsertLine); Disable( STATUSDLG ); // Create program folders and icons. InstallProgramItems: SetStatusWindow( 95, "Creating Program Folder and Icons...." ); if (bWinNT || bWin32s) then AppCommand( PROGMAN, CMD_RESTORE ); svFolder = PROGRAM_FOLDER_NAME; CreateProgramFolder( svFolder ); ShowProgramFolder( svFolder, 0 ); LongPathToShortPath( svTarget ); Delay(1); endif; svFolder = "Linguist"; szProgram = svTarget ^ "Linguist\\PROGRAM\\LINGUIST.EXE"; if (bWinNT || bWin32s || bWin95) then LongPathToQuote( szProgram, TRUE ); AddFolderIcon( svFolder, APP_NAME, szProgram, svTarget ^ "Linguist\\PROGRAM", "", 0, "", REPLACE ); Delay( 1 ); szParam = svTarget ^ "Linguist\\Program\\linguist.HLP"; AddFolderIcon( svFolder, "Linguist Help", "WINHELP.EXE" + " " + szParam, svTarget ^ "Linguist\\Program", "", 0, "", REPLACE ); Delay( 1 ); szParam = svTarget ^ "Linguist\\Program\\lingui~1.HLP"; AddFolderIcon( svFolder, "Pertolongan Ahli Bahasa", "WINHELP.EXE" + " " + szParam, svTarget ^ "Linguist\\Program", "", 0, "", REPLACE ); Delay( 1 ); szParam = svTarget ^ "\\Linguist\\README.TXT"; AddFolderIcon( svFolder, "readme ", "NOTEPAD.EXE " + szParam, svTarget, "", 0, "", REPLACE ); Delay( 1 ); szProgram = WINDIR ^ "UNINST.EXE"; LongPathToShortPath( szProgram ); LongPathToShortPath( svUninstLogFile ); szProgram = szProgram + " -f" + svUninstLogFile; AddFolderIcon( svFolder, "unInstallShield", szProgram, WINDIR, "", 0, "", REPLACE ); ShowProgramFolder(svFolder,SW_SHOW); else LongPathToQuote( szProgram, TRUE ); AddFolderIcon( "", APP_NAME, szProgram, svTarget ^ "Linguist\\PROGRAM", "", 0, "", REPLACE ); endif; Delay( 1 ); // Announce setup complete and offer to read README file.e FinalInstallProcess: SetStatusWindow( 100, "Installation complete." ); if (AskYesNo( "Do you want to view the README file now?", YES ) = YES) then LaunchApp( "NOTEPAD.EXE", svTarget ^ "\\Linguist\\README.TXT" ); Delay( 2 ); endif; 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; if (nvResult = IS_WINDOWSNT) then bWinNT = TRUE; // Running Windows NT. elseif (nvResult = IS_WIN32S) then bWin32s = TRUE; // Running Win32s. elseif (nvResult = IS_WINDOWS95) then bWin95 = TRUE; // Running Win95 endif; end; #include "sddialog.rul"