InstallScript的事件

InstallScript的事件

InstallScript MSI Preject项目中可以根据需要编写脚本控制安装过程,下面介绍几个重要的事件,事件分为三大类:Before Move Data(安装数据前)、Move Data(安装数据过程中)、After Move Data(安装数据后)。

1.1      Before Move Data

1.1.1  OnFirstUIBefore

在第一次安装时,在复制安装数据之前触发的事件,更改这个事件的脚本可自定义安装步骤。

下面给出InstallShield自身的脚本:

function OnFirstUIBefore()
    NUMBER nResult, nSetupType, nvSize, nUser;
    STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile;
    STRING szLicenseFile;
    LIST list, listStartCopy;
     BOOL bCustom;
begin   
    // TO DO: if you want to enable background, window title, and caption bar title                                                                  
    // SetTitle( @PRODUCT_NAME, 24, WHITE );                                       
    // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );                        
    // Enable( FULLWINDOWMODE );                          
    // Enable( BACKGROUND );                                  
    // SetColor(BACKGROUND,RGB (0, 128, 128));                     
     SHELL_OBJECT_FOLDER = @PRODUCT_NAME;  
   
     nSetupType = TYPICAL; 
Dlg_SdWelcome:
    szTitle = "";
    szMsg   = "";
    nResult = SdWelcome(szTitle, szMsg);
    if (nResult = BACK) goto Dlg_SdWelcome;
    
     szTitle   = "";
     svName    = "";
    svCompany = "";
Dlg_SdCustomerInformation:
     nResult = SdCustomerInformation(szTitle, svName, svCompany, nUser);
     if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SetupType:
    szTitle = "";
    szMsg   = "";
    nResult = SetupType(szTitle, szMsg, "", nSetupType, 0);
    if (nResult = BACK) then
        goto Dlg_SdCustomerInformation;
    else
         nSetupType = nResult;
        if (nSetupType != CUSTOM) then
             nvSize = 0;
             FeatureCompareSizeRequired(MEDIA, INSTALLDIR, nvSize);
             if (nvSize != 0) then     
             MessageBox(szSdStr_NotEnoughSpace, WARNING);
                 goto Dlg_SetupType;
            endif;
              bCustom = FALSE;
              goto Dlg_SQL;
         else
              bCustom = TRUE;
        endif;
    endif;   
Dlg_SdAskDestPath:   
    nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
    if (nResult = BACK) goto Dlg_SetupType;
Dlg_SdFeatureTree:
    szTitle    = "";
    szMsg      = "";
    if (nSetupType = CUSTOM) then
         nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, "", 2);
         if (nResult = BACK) goto Dlg_SdAskDestPath; 
    endif;
Dlg_SQL:
    nResult = OnSQLLogin( nResult );
    if( nResult = BACK ) then
    if (!bCustom) then
         goto Dlg_SetupType;   
    else
         goto Dlg_SdFeatureTree;
    endif;
    endif;
Dlg_SdStartCopy:
    szTitle = "";
    szMsg   = "";
    listStartCopy = ListCreate( STRINGLIST );
    //The following is an example of how to add a string(svName) to a list(listStartCopy).
    //eg. ListAddString(listStartCopy,svName,AFTER);
    nResult = SdStartCopy( szTitle, szMsg, listStartCopy );          
    ListDestroy(listStartCopy);
    
     if (nResult = BACK) then
    goto Dlg_SQL;
    endif;
    // setup default status
    Enable(STATUSEX);
 
    return 0;
end;


从上面代码可以看出在没有安装类型界面时没有选择自定义安装时安装程序不会进入安装路径选择界面,这样用户不能自己选择安装路径,在Dlg_SetupType标签节中做一些修改,使不论怎么样都会进入安装路径选择界面,下面给出更改代码:

Dlg_SetupType:
    szTitle = "";
    szMsg   = "";
    nResult = SetupType(szTitle, szMsg, "", nSetupType, 0);
    if (nResult = BACK) then
        goto Dlg_SdCustomerInformation;
    else
         nSetupType = nResult;
        if (nSetupType != CUSTOM) then
             nvSize = 0;
             FeatureCompareSizeRequired(MEDIA, INSTALLDIR, nvSize);
             if (nvSize != 0) then     
             MessageBox(szSdStr_NotEnoughSpace, WARNING);
                 goto Dlg_SetupType;
            endif;
              bCustom = FALSE;
              nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
if (nResult = BACK) goto Dlg_SetupType
goto Dlg_SQL;
         else
              bCustom = TRUE;
        endif;
    endif;  

 

1.1.2  OnMaintUIBefore

在修改或卸载时,在复制安装数据之前触发的事件,例如安装程序在安装时添加了一个NT Service,在卸载时安装程序不会将将此服务反安装,这时就需要在这个事件中通过脚本LaunchApp (APPLICATION, “-uninstall”)手工删除服务。

1.1.3  OnSQLLogin

MS SQL SERVER数据库安装登录函数,InstallShield将此函数列出在InstallScript中应该是便于用户自行修改此函数。

1.2           Move Data

这个类型当中的事件一般来说不需要改动。

1.2.1  OnGeneratingMSIScript

Action(动作) LauchConditions之前执行;

1.2.2  OnGeneratedMSIScript

Action(动作) LauchConditions之后执行;

1.2.3  OnInstallFilesActionBefore

Action(动作) InstallFiles之前执行;

1.2.4  OnInstallFilesActionAfter

Action(动作) InstallFiles之后执行;

1.2.5  OnMoving

Action(动作) InstallInitialize之后执行;

1.2.6  OnMoved

Action(动作) GeneratedMSIScript之前执行;

1.3      After Move Data

1.3.1  OnFirstUIAfter

在第一次安装时,在复制安装数据之后触发的事件,例如有一个系统需要将安装路径设置FTP虚拟目录,如果在安装数据之前就设置的话,该路径不存在,无法设置成功,因此需要在这个事件中设置。

1.3.2  OnMaintUIAfter

在修改或卸载时,在修改或卸载数据之后触发的事件;

1.3.3  OnEnd

在安装完成之后触发的事件,即点击【完成】按钮后触发的事件,例如用附加数据库方式创建数据库时可在此事件中进行。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
缺少installscript引擎,请运行ISScript.msi(如果有的话)解决方案 2008-01-07 18:25:25| 分类: 计算机相关 |字号 订阅 “缺少计算机引擎installscript,请运行ISScript.msi(如果有的话)”这样的错误,在网上找了解决的方法,并且实验成功,在这里分享一下 ------------------------------------------------------------------------------------------------------------------------------------------------ 解决方法: ISScript.msi是安装补丁,安装文件必须要有的系统文件。 你可以用下述方法试一下 1、打开C:\Program Files\Common Files\InstallShield\Driver目录 2、删除目录中的其他目录 3、清空C:\Program Files\Common Files\InstallShield\Professional\RunTime\目录中的其他目录。 4、下载并按次序安装: http://support.installshield.com ... 2/IkernelUpdate.exe http://support.installshield.com/kb/files/Q108322/ISScript7x.zip http://support.installshield.com/kb/files/Q108322/ISScript8.zip http://support.installshield.com/kb/files/Q108322/ISScript10.zip http://support.installshield.com/kb/files/Q108322/ISScript101.zip http://support.installshield.com ... 22/ISScript1050.zip http://support.installshield.com/kb/files/Q108322/ISScript11.zip http://www.installengine.com/cert05/isengine/ISScript1150.Msi 5、完成后,在开始菜单运行中输入 services.msc 回车,选择自动执行Install Drive Table Manager服务,并开启。 ----------------------------------------------------------------------------------------------------------------------------------------------- OK,问题解决。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值