Installshield6.22安装脚本文件样例
全文如下:
////////////////////////////////////////////////////////////////////////////////
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This script was generated based on the selections you made in
// the Project Wizard. Refer to the help topic entitled "Modify
// the script that the Project Wizard generates" for information
// on possible next steps.
//
////////////////////////////////////////////////////////////////////////////////
// Include header files
#include "ifx.h"
////////////////////// string defines ////////////////////////////
//////////////////// installation declarations ///////////////////
// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
// your script function prototypes
prototype Pdkey(STRING);
prototype SetupFolders();
prototype SetupRegistry();
// your global variables
STRING szmserial1,szmserial2,szmserial3,szmserial4,szmserial5;
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnFirstUIBefore
//
// EVENT: FirstUIBefore event is sent when installation is run for the first
// time on given machine. In the handler installation usually displays
// UI allowing end user to specify installation parameters. After this
// function returns, ComponentTransferData is called to perform file
// transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()
number nResult,nSetupType;
string szTitle, szMsg;
string szLicenseFile, szQuestion;
string szName, szCompany, szSerial;
string szFile;
string szTargetPath;
string szDir;
string szfolder;
string szComponents, szTargetdir;
number nLevel;
LIST listStartCopy;
LIST list;
number nvSize,rc;
begin
// TO DO: if you want to enable background, window title, and caption bar title
// SetTitle( @TITLE_MAIN, 24, WHITE );
// SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );
// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
// SetColor(BACKGROUND,RGB (0, 128, 128));
nSetupType = TYPICAL;
TARGETDIR = PROGRAMFILES ^"KYKQ";
szDir = TARGETDIR;
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
szName = "";
szCompany = "";
szSerial = "";
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense:
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle = "";
szMsg = "";
szQuestion = "";
nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdShowInfoList:
szFile = SUPPORTDIR ^ "infolist.txt";
list = ListCreate( STRINGLIST );
ListReadFromFile( list, szFile );
szTitle = "";
szMsg = "";
nResult = SdShowInfoList( szTitle, szMsg, list );
ListDestroy( list );
if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SdRegisterUserEx:
szMsg = "";
szTitle = "";
nResult = SdRegisterUserEx( szTitle, szMsg, szName, szCompany, szSerial );
rc=Pdkey(szSerial);
if (( rc!=1) && (nResult != BACK)) then
MessageBox ( "序列号输入错误" , WARNING );
goto Dlg_SdRegisterUserEx;
else
if (nResult = BACK) then
goto Dlg_SdShowInfoList;
endif;
endif;
Dlg_SdAskDestPath:
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
TARGETDIR = szDir;
if (nResult = BACK) goto Dlg_SdRegisterUserEx;
Dlg_SetupType:
szTitle = "";
szMsg = "";
nResult = SetupType ( szTitle , szMsg , "" , nSetupType , 0 );
if (nResult = BACK) then
goto Dlg_SdAskDestPath;
else
nSetupType = nResult;
if (nSetupType != CUSTOM) then
szTargetPath = TARGETDIR;
nvSize = 0;
ComponentCompareSizeRequired(MEDIA,szTargetPath,nvSize);
if (nvSize != 0) then
MessageBox( szSdStr_NotEnoughSpace, WARNING );
goto Dlg_SetupType;
endif;
endif;
endif;
Dlg_SdComponentTree:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType;
szTitle = "";
szMsg = "";
szTargetdir = TARGETDIR;
szComponents = "";
nLevel = 2;
if (nSetupType = CUSTOM) then
nResult = SdComponentTree(szTitle, szMsg, szTargetdir, szComponents, nLevel);
if (nResult = BACK) goto Dlg_SetupType;
endif;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages(nResult);
if (nResult = BACK) goto Dlg_SdComponentTree;
Dlg_SdSelectFolder:
szfolder = SHELL_OBJECT_FOLDER;
szTitle = "";
szMsg = "";
nResult = SdSelectFolder( szTitle, szMsg, szfolder );
SHELL_OBJECT_FOLDER = szfolder;
if (nResult = BACK) goto Dlg_ObjDialogs;
Dlg_SdStartCopy:
szTitle = "";
szMsg = "";
listStartCopy = ListCreate( STRINGLIST );
//The following is an example of how to add a string(szName) to a list(listStartCopy).
ListAddString(listStartCopy,"你的选择如下:",AFTER);
ListAddString(listStartCopy,"\n",AFTER);
ListAddString(listStartCopy,"用户名:"+szName,AFTER);
ListAddString(listStartCopy,"公司名称:"+szCompany,AFTER);
ListAddString(listStartCopy,"\n",AFTER);
ListAddString(listStartCopy,"安装路径:"+TARGETDIR,AFTER);
ListAddString(listStartCopy,"\n",AFTER);
ListAddString(listStartCopy,"程序组名:"+SHELL_OBJECT_FOLDER,AFTER);
ListAddString(listStartCopy,"\n",AFTER);
if (nSetupType = CUSTOM) then
ListAddString(listStartCopy,"安装类型:"+"自定义",AFTER);
elseif (nSetupType = TYPICAL) then
ListAddString(listStartCopy,"安装类型:"+"典型",AFTER);
elseif (nSetupType = COMPACT) then
ListAddString(listStartCopy,"安装类型:"+"压缩",AFTER);
endif;
nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);
if (nResult = BACK) goto Dlg_SdSelectFolder;
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMoving
//
// EVENT: Moving event is sent when file transfer is started as a result of
// ComponentTransferData call, before any file transfer operations
// are performed.
//
///////////////////////////////////////////////////////////////////////////////
function OnMoving()
string szAppPath,szUncmd;
int iPos;
begin
// Set LOGO Compliance Application Path
// TO DO : if your application .exe is in a subfolder of TARGETDIR then add subfolder
szAppPath = TARGETDIR;
RegDBSetItem(REGDB_APPPATH, szAppPath);
RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);
szUncmd = "UNINSTALL_CMD";
iPos = StrFind(UNINSTALL_STRING,szUncmd);
if iPos>0 then
UNINSTALL_STRING[iPos - 1]='\0';
UNINSTALL_STRING=UNINSTALL_STRING + ",LaunchSetup \"" + DISK1TARGET+"\\setup.exe\"";
MaintenanceStart();
endif;
end;
/////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMoved
//
// EVENT: Moved event is sent when file transfer started by ComponentTransferData call
// has finished. At this point all file transfer operations are completed
// except for batch self-registration which is performed immediately after this
// function returns. During uninstallation this event sent after uninstallation
// is completed. For that reason you should not modify system state in this
// event handler.
//
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnBegin
//
// EVENT: Begin event is always sent as the first event during installation.
//
//////////////////////////////////////////////////////////////////////////////
function OnBegin()
begin
szmserial1="0910-3256021-111";
szmserial2="0910-3254321-71301";
szmserial3="0910-3254321-71311";
szmserial4="0910-860023-111";
szmserial5="1111-111111-111";
end;
// --- include script file section ---
function Pdkey(key)
NUMBER rc;
begin
rc=0;
if key = szmserial1 then
rc=1;
goto rc_no;
endif;
if key = szmserial2 then
rc=1;
goto rc_no;
endif;
if key = szmserial3 then
rc=1;
goto rc_no;
endif;
if key = szmserial4 then
rc=1;
goto rc_no;
endif;
if key = szmserial5 then
rc=1;
endif;
rc_no:
return rc;
end;
function SetupRegistry()
STRING szDBprofile,szDB,szDriver,szDriver1,szSetup