InstallShield安装脚本

  最近在用installshield做一键安装,终于搞定,记录一下!

//===========================================================================
//
//  File Name:    Setup.rul
//
//  Description:  Blank setup main script file
//
//  Comments:     Blank setup is an empty setup project. If you want to
//                  create a new project via. step-by step instructions use the
//                  Project Assistant.
//
//===========================================================================

// Included header files ----------------------------------------------------
#include "ifx.h"    

function OnBegin()    
STRING strFramework;   
STRING strVersion;     
INT iVersion;
begin      
    SetTitle(IFX_PRODUCT_NAME + " 安装向导", 0, BACKGROUNDCAPTION);   
    
    SdShowMsg("安装程序正在检测系统必备组件。。。",TRUE);  
    Delay(2);
    SdShowMsg("",FALSE);  
                      
    RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );  
    strFramework = SRCDIR ^ "dotnetfx35"^"wcu"^"dotNetFramework"^"dotNetFx35setup.exe";//放在Disk1上的可执行文件路径
    if(RegDBKeyExist("SOFTWARE\\Microsoft\\.NETFramework\\v3.0") < 0)
    then    
    
        VerGetFileVersion(WINDIR^"system32"^"msiexec.exe",strVersion); //取得文件版本号(判断windows installer版本)
        if(strVersion < "3.1")
        then    
            if(LaunchAppAndWait(SUPPORTDIR^"WindowsInstaller-KB893803-v2-x86.exe","",LAAW_OPTION_WAIT)<0)
            then       
                MessageBox("WindowsInstaller error",INFORMATION);    
                abort;
            endif;
        endif;   

               
        if( LaunchAppAndWait(strFramework, "/q:a/l" ,LAAW_OPTION_WAIT) < 0) 
        then
            SprintfBox(MB_OK,".NET安装",".NET FrameWork安装失败!");    
            abort;
        endif;
    endif;             
            
    if(RegDBKeyExist("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{1F1C2DFC-2D24-3E06-BCB8-725134ADF989}") < 0)//判断机器是否安装了c++2008运行库 
    then   
        if(LaunchAppAndWait(SUPPORTDIR^"(C++2008)vcredist2008.exe","/s",WAIT)<0)
        then       
            MessageBox("(C++2008)vcredist2008 error",INFORMATION);     
            abort;
        endif;
    endif;
    
    if(RegDBKeyExist("SOFTWARE\\MapInfo\\MapInfo") < 0)    
    then   
        if(LaunchAppAndWait(SUPPORTDIR^"MapX4.5.exe","",WAIT)<0)
        then       
            MessageBox("MapX4.5 error",INFORMATION);    
            abort;
        endif;
    endif;
end;

 

posted @ 2014-03-10 16:54  cg.2019  阅读(1152)  评论(0编辑  收藏  举报