//////////////////////////////////////////////////////////////////////////////
// 用InstallShield 進行 ASP 軟件的打包和自動安裝
// 原創作者: 賈俊 (Jaron)
// 網址:
// 郵件:
// 首次發表於網易
//////////////////////////////////////////////////////////////////////////////
// 功能
//
//
//
//
//
//
//
// 本文僅列出了 InstallShield 的 Script 部分
// 測試過程中有任何問題
//////////////////////////////////////////////////////////////////////////////
prototype CreateDataBase(STRING
prototype CreateWebSite(STRING
prototype CreateVirtualDir(STRING); // 創建虛擬目錄
//////////////////////////////////////////////////////////////////////////////
//
// 函數: OnFirstUIBefore
//
// 事件: FirstUIBefore event is sent when installation is run for the first
// time on given machine
// UI allowing end user to specify installation parameters
// function returns
// transfer
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()
NUMBER nResult
STRING szTitle
STRING szLicenseFile
STRING szServerIP
STRING szSQLsvr
STRING svName
STRING szFile
STRING szComponents
STRING szField
STRING szDefault
OBJECT piisObj;
LIST list
NUMBER nLevel
begin
szBmpPath=
DialogSetInfo (DLG_INFO_ALTIMAGE
//To Do: if you want to enable background
//SetTitle( @TITLE_MAIN
//SetTitle( @TITLE_CAPTIONBAR
//Enable( FULLWINDOWMODE );
//Enable( BACKGROUND );
//SetColor(BACKGROUND
//默認值設定
TARGETDIR =
szDir = TARGETDIR;
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
svName =
svCompany =
svSerial =
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome: //歡迎 對話框
szTitle =
szMsg =
nResult = SdWelcome( szTitle
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense://軟件許可協議 對話框
szLicenseFile = SUPPORTDIR ^
szTitle =
szMsg =
szQuestion =
nResult = SdLicense( szTitle
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdShowInfoList://readme文件 對話框
szFile = SUPPORTDIR ^
list = ListCreate( STRINGLIST );
ListReadFromFile( list
szTitle =
szMsg =
nResult = SdShowInfoList( szTitle
ListDestroy( list );
if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SdRegisterUserEx://用戶信息 對話框
szMsg =
szTitle =
nResult = SdRegisterUserEx( szTitle
if (nResult = BACK) goto Dlg_SdShowInfoList;
//檢查序列號
//if (CHK_serial(svCompany
//goto Dlg_SdRegisterUserEx;
//endif;
//檢查序列號完畢
Dlg_SdAskDestPath://安裝位置 對話框
szTitle =
szMsg =
nResult = SdAskDestPath( szTitle
TARGETDIR = szDir;
if (nResult = BACK) goto Dlg_SdRegisterUserEx;
Dlg_SetupType: //安裝類型 對話框
nSetupType = TYPICAL;
szTitle =
szMsg =
nResult = SetupType ( szTitle
if (nResult = BACK) then
goto Dlg_SdAskDestPath;
else
nSetupType = nResult;
if (nSetupType != CUSTOM) then
szTargetPath = TARGETDIR;
nvSize =
ComponentCompareSizeRequired(MEDIA
if (nvSize !=
MessageBox( szSdStr_NotEnoughSpace
goto Dlg_SetupType;
endif;
endif;
endif;
Dlg_SdComponentTree: //對話框
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType;
szTitle =
szMsg =
szTargetdir = TARGETDIR;
szComponents =
nLevel =
if (nSetupType = CUSTOM) then
nResult = SdComponentTree(szTitle
if (nResult = BACK) goto Dlg_SetupType;
endif;
Dlg_SdSelectFolder://對話框
szfolder = SHELL_OBJECT_FOLDER;
szTitle =
szMsg =
nResult = SdSelectFolder( szTitle
SHELL_OBJECT_FOLDER = szfolder;
if (nResult = BACK) goto Dlg_SdComponentTree;
Dlg_SelMode ://設置數據庫服務器 對話框
szTitle =
szMsg =
szField
szField
svEdit
svEdit
SetDialogTitle(DLG_ASK_TEXT
//DialogSetInfo ( DLG_INFO_CHECKSELECTION
nOpt = EXCLUSIVE ;
nResult = AskOptions (nOpt
if (nResult = BACK) goto Dlg_SdSelectFolder;
if (svEdit
Dlg_AskText ://設置數據庫服務器 對話框
szTitle =
szMsg =
szQuestion=
szServerIP=
szServerPort=
szServerIPDefault=
szServerPortDefault=
SetDialogTitle(DLG_ASK_TEXT
nResult=SdShowDlgEdit
if (nResult = BACK) goto Dlg_SelMode;
Dlg_AskSQL ://設置數據庫服務器 對話框
szTitle =
szMsg =
szQuestion=
szSQLsvr=
szSQLusr=
szSQLpwd=
svSQLsvr=
svSQLusr=
szSQLpwd=
SetDialogTitle(DLG_ASK_TEXT
nResult=SdShowDlgEdit
if (nResult = BACK) goto Dlg_SelMode;
Dlg_SdStartCopy://開始復制文件 對話框
szTitle =
szMsg =
listStartCopy = ListCreate( STRINGLIST );
ListAddString(listStartCopy
ListAddString(listStartCopy
ListAddString(listStartCopy
ListAddString(listStartCopy
if (svEdit
ListAddString(listStartCopy
ListAddString(listStartCopy
endif;
ListAddString(listStartCopy
nResult = SdStartCopy( szTitle
ListDestroy(listStartCopy);
if (nResult = BACK) goto Dlg_AskText;
// setup default status
SetStatusWindow(
Enable(STATUSEX);
StatusUpdate(ON
if (svEdit
CreateWebSite(szServerIPDefault
endif;
if (svEdit
CreateVirtualDir(
endif;
CreateDataBase(svSQLsvr
return
end;
//////////////////////////////////////////////////////////////////////////////
//
// 函數: OnFirstUIAfter
//
// 事件: FirstUIAfter event is sent after file transfer
// is run for the first time on given machine
// installation usually displays UI that will inform end user that
// installation has been completed successfully
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIAfter()
STRING szTitle
NUMBER bOpt
begin
//set_vod_liveaddress();
szCmdLine = SUPPORTDIR ^
if (LaunchAppAndWait(szCmdLine
MessageBox (
endif;
Disable(STATUSEX);
bOpt
bOpt
szMsg
szMsg
szOption
szOption
szTitle = @PRODUCT_NAME+
SdFinishEx(szTitle
szCmdLine = //LocalHost
//if (LaunchApp(PROGRAMFILES ^
//MessageBox (
//endif;
return
end;
//////////////////////////
// 創建IIS站點
//////////////////////////
function CreateWebSite(szServerIPDefault
STRING szCmdLine
begin
if ((szServerIPDefault =
MessageBox (
else
szWaitTxt=
SdShowMsg (szWaitTxt
Delay(
szCmdLine = SUPPORTDIR ^
if (LaunchAppAndWait(
MessageBox (
endif;
SdShowMsg (szWaitTxt
endif;
return
end;
//////////////////////////
// 創建虛擬目錄
//////////////////////////
function CreateVirtualDir(VirtualFolder)
STRING szCmdLine
begin
if (VirtualFolder =
MessageBox (
else
szWaitTxt=
SdShowMsg (szWaitTxt
Delay(
szCmdLine = SUPPORTDIR ^
if (LaunchAppAndWait(
MessageBox (
endif;
SdShowMsg (szWaitTxt
endif;
return
end;
//////////////////////////
// 創建和優化數據庫
//////////////////////////
function CreateDataBase(svSQLsvr
STRING szCmdLine
begin
szWaitTxt=
SdShowMsg (szWaitTxt
Delay(
szCmdLine =
if (LaunchAppAndWait(
MessageBox (
endif;
SdShowMsg (szWaitTxt
szWaitTxt=
SdShowMsg (szWaitTxt
Delay(
szCmdLine =
if (LaunchAppAndWait(
MessageBox (
endif;
SdShowMsg (szWaitTxt
return
end;
From:http://tw.wingwit.com/Article/program/yxkf/201401/30229.html