如何在 InstallScript 的单个安装文件中添加两种安装类型

本文关键字:安装 文件 两种 类型 添加 单个 InstallScript | 更新日期: 2023-09-27 18:33:09

我正在使用InstallShield 2013部署包,我想在单个安装文件中添加两种安装类型(两个应用程序)。我的意思是,用户应该能够在installShield上运行安装文件时选择要安装的应用程序。

背景

在我的安装文件中,有两个应用程序作为控制台和查看器。用户可以选择他/她想要的应用程序,但所选应用程序的进一步安装不起作用。需要帮助!

这是我的代码。

function OnFirstUIBefore()
      NUMBER nResult, nType;   
      STRING szTitle, szMsg, svResult, szCaption;   
      NUMBER nSetupType, nvSize, nUser, nReserved;
      STRING szQuestion, svName, svCompany, szFile, szLicense;
      STRING szLicenseFile,szReserved, svSetupType;
      LIST list, listStartCopy;
      BOOL bCustom, bCopy, bDontCopy;
begin           
      MessageBox("OnFirstUIBefore()",0);
      SHELL_OBJECT_FOLDER = @PRODUCT_NAME;     
      nSetupType = CUSTOM;     
      bCopy = FALSE ; 
      bDontCopy = TRUE ; 
      bCustom = TRUE;      
      szLicense = SUPPORTDIR^ "AbcTerms.rtf";   
Dlg_SdWelcome:
    szTitle = "";
    szMsg   = "";
    nResult = SdWelcome(szTitle, szMsg);
    if (nResult = BACK) goto Dlg_SdWelcome; 
    szTitle   = "";
    svName    = "";
    svCompany = "";   
Dlg_SdLicense:            
   nResult = SdLicense2Rtf ( "","" , "", szLicense , FALSE );    
   if(nResult = BACK) goto  Dlg_SdWelcome;
Dlg_SdCustomerInformation:
    nResult = SdCustomerInformation(szTitle, svName, svCompany, nUser);
    if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SetupType:            
    szTitle = "Please select installation type"; 
    szMsg = ""; 
    szReserved  = ""; 
    svSetupType = "Viewer"; 
    nReserved   = 0;  
    nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, nReserved);
    INSTALLTYPE =  svSetupType;   //"Console";//  
    if(svSetupType == "Console") then  
         MsiSetProperty( ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' ); 
         MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" ,  "ConsoleV3");//"1:3"           
    else
         MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ViewerV3" );     //"1:2"        
    endif;
    MsiSetProperty( ISMSI_HANDLE, "SOURCEPATH" , SourceDir ); 
    if (nResult = BACK) goto Dlg_SdCustomerInformation; 
Dlg_SdAskDestPath:      
    nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
    if (nResult = BACK) goto Dlg_SetupType;     
Enable(STATUSEX);
    return 0; end;    

编辑的代码

function OnFirstUIBefore()
      NUMBER nResult, nType;   
      STRING szTitle, szMsg, svResult, szCaption;   
      NUMBER nSetupType, nvSize, nUser, nReserved;
      STRING szQuestion, svName, svCompany, szFile, szLicense;
      STRING szLicenseFile,szReserved, svSetupType;
      LIST list, listStartCopy;
      BOOL bCustom, bCopy, bDontCopy;
begin           
      MessageBox("OnFirstUIBefore()",0);
      SHELL_OBJECT_FOLDER = @PRODUCT_NAME;     
      nSetupType = CUSTOM;     
      bCopy = FALSE ; 
      bDontCopy = TRUE ; 
      bCustom = TRUE;      
      szLicense = SUPPORTDIR^ "AbcTerms.rtf";   
Dlg_SdWelcome:
    szTitle = "";
    szMsg   = "";
    nResult = SdWelcome(szTitle, szMsg);
    if (nResult = BACK) goto Dlg_SdWelcome; 
    szTitle   = "";
    svName    = "";
    svCompany = "";   
Dlg_SdLicense:            
   nResult = SdLicense2Rtf ( "","" , "", szLicense , FALSE );    
   if(nResult = BACK) goto  Dlg_SdWelcome;
Dlg_SdCustomerInformation:
    nResult = SdCustomerInformation(szTitle, svName, svCompany, nUser);
    if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SetupType:            
    szTitle = "Please select installation type"; 
    szMsg = ""; 
    szReserved  = ""; 
    svSetupType = "Viewer"; 
    nReserved   = 0;  
    nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, nReserved);
    INSTALLTYPE =  svSetupType;   //"Console";// 
    MsiSetProperty( ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' );
    if(svSetupType == "Console") then  
         MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" ,  "ConsoleV3");//"1:3"           
    else
         MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ViewerV3" );     //"1:2"        
    endif;
    MsiSetProperty( ISMSI_HANDLE, "SOURCEPATH" , SourceDir ); 
    if (nResult = BACK) goto Dlg_SdCustomerInformation; 
Dlg_SdAskDestPath:      
    nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
    if (nResult = BACK) goto Dlg_SetupType;     
Enable(STATUSEX);
    return 0; end;

如何在 InstallScript 的单个安装文件中添加两种安装类型

这工作正常。

function OnFirstUIBefore()
      NUMBER nResult, nType;   
      STRING szTitle, szMsg, svResult, szCaption;   
      NUMBER nSetupType, nvSize, nUser, nReserved;
      STRING szQuestion, svName, svCompany, szFile, szLicense;
      STRING szLicenseFile,szReserved, svSetupType;
      LIST list, listStartCopy;
      BOOL bCustom, bCopy, bDontCopy;
begin           
      MessageBox("OnFirstUIBefore()",0);
      SHELL_OBJECT_FOLDER = @PRODUCT_NAME;     
      nSetupType = CUSTOM;     
      bCopy = FALSE ; 
      bDontCopy = TRUE ; 
      bCustom = TRUE;      
      szLicense = SUPPORTDIR^ "AbcTerms.rtf";   
Dlg_SdWelcome:
    szTitle = "";
    szMsg   = "";
    nResult = SdWelcome(szTitle, szMsg);
    if (nResult = BACK) goto Dlg_SdWelcome; 
    szTitle   = "";
    svName    = "";
    svCompany = "";   
Dlg_SdLicense:            
   nResult = SdLicense2Rtf ( "","" , "", szLicense , FALSE );    
   if(nResult = BACK) goto  Dlg_SdWelcome;
Dlg_SdCustomerInformation:
    nResult = SdCustomerInformation(szTitle, svName, svCompany, nUser);
    if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SetupType:            
    szTitle = "Please select installation type"; 
    szMsg = ""; 
    szReserved  = ""; 
    svSetupType = "Viewer"; 
    nReserved   = 0;  
    nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, nReserved);
    INSTALLTYPE =  svSetupType;   //"Console";// 
    MsiSetProperty( ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' );
    if(svSetupType == "Console") then  
         MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" ,  "ConsoleV3");//"1:3"           
    else
         MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ViewerV3" );     //"1:2"        
    endif;
    MsiSetProperty( ISMSI_HANDLE, "SOURCEPATH" , SourceDir ); 
    if (nResult = BACK) goto Dlg_SdCustomerInformation; 
Dlg_SdAskDestPath:      
    nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
    if (nResult = BACK) goto Dlg_SetupType;     
Enable(STATUSEX);
    return 0; end;