感谢一些前辈的分享,然后自己根据网上的资源,阅读并自己测试了自己的测试工程。

为了方便自己下一次的检索和使用,也方便他人的参考借鉴写了这篇文章。

//===========================================================================

//
//  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.
//
//===========================================================================
#define EXAMPLE_DIR "D:\\PTC\\CEAnnotation"    //并没有使用,想使用的一个宏定义
// Included header files ----------------------------------------------------
#include "ifx.h"

// Note: In order to have your InstallScript function executed as a custom
// action by the Windows Installer, it must be prototyped as an 
// entry-point function.

// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
    
/* export prototype MyFunction(HWND); */
          
//安装程序的准备界面
function OnBegin()
begin
// Clear ALLUSERS if specified in the command line.
if( CMDLINE % "ALLUSERS=FALSE" ) then
ALLUSERS = FALSE;
endif;
end;

//安装的每一个对话框处理
function OnFirstUIBefore()
    number  nResult, nLevel, nSize, nSetupType, nUser;
    string  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
    string  szName, szCompany, szTargetPath, szDir, szFeatures;
    BOOL    bLicenseAccepted;
begin    
//用户点击取消,不做任何处理
  if( REMOVEONLY ) then
        Disable( DIALOGCACHE );
szMsg = SdLoadString( IDS_IFX_ERROR_PRODUCT_NOT_INSTALLED_UNINST );
    SdSubstituteProductInfo( szMsg );
MessageBox( szMsg, SEVERE );
abort;
   endif;
   
  nSetupType = COMPLETE;
szDir = TARGETDIR;
szName = "";
szCompany = "";
bLicenseAccepted = FALSE;

// Beginning of UI Sequence
Dlg_Start:
    nResult = 0;

//安装向导的欢迎界面
Dlg_SdWelcome:
    szTitle = "";
    szMsg = "";
    //{{IS_SCRIPT_TAG(Dlg_SdWelcome)
    nResult = SdWelcome( szTitle, szMsg );
    //}}IS_SCRIPT_TAG(Dlg_SdWelcome)
    if (nResult = BACK) goto Dlg_Start;

//许可界面
Dlg_SdLicense2:
    szTitle = "";
    szOpt1 = "";
    szOpt2 = "";
    //{{IS_SCRIPT_TAG(License_File_Path) 
    // 许可文件,在Behavior and Logic/ support Files/Billboards/简体中中插入的一个licence.rtf
    // 该文件可以自己编写,相应安装的界面就显示相应的内容
    szLicenseFile = SUPPORTDIR ^ "License.rtf";
    //}}IS_SCRIPT_TAG(License_File_Path)
    //{{IS_SCRIPT_TAG(Dlg_SdLicense2)
    nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
    //}}IS_SCRIPT_TAG(Dlg_SdLicense2)
    if (nResult = BACK) then
        goto Dlg_SdWelcome; //直接转到
    else
        bLicenseAccepted = TRUE;
    endif;

/* 
Dlg_SdAskDestPath2:
nSetupType = CUSTOM;
    if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdLicense2;
szTitle = "";
    szMsg = "";
    if (nSetupType = CUSTOM) then
                //{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
nResult = SdAskDestPath2( szTitle, szMsg, szDir );
                //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
        TARGETDIR = szDir;
    endif;
    //if (nResult = BACK) goto Dlg_SetupType2;   
*/
   
//设置安装界面,帮用户指定安装目录
Dlg_SdAskDestPath2: 
szTitle="系统安装目录"; 
szMsg="选择D:\\PTC目录,以启动程序!"; 
szDir="D:\\PTC";
//设置安装路径
nResult = SdAskDestPath2( szTitle, szMsg, szDir );
TARGETDIR = szDir; 
if ((nResult = BACK)) goto Dlg_SdLicense2;
   
   //拷贝所有文件
Dlg_SdStartCopy2:
    szTitle = "";
    szMsg = "";
    //{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)
    nResult = SdStartCopy2( szTitle, szMsg );
    //}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
    if (nResult = BACK) goto Dlg_SdAskDestPath2;

// Added in 11.0 - Set appropriate StatusEx static text.
    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
    Enable(STATUSEX);
    return 0;
end;

//注册表等设置  
export prototype MainApp_Installed();
function MainApp_Installed()
NUMBER nSize, nType, nIcon;
STRING szKey, szName, szValue; 
STRING szProgramFolder, szItemName, szCommandLine;
STRING szWorkingDir, szIconPath, szShortCutKey;
begin

// Create a sample registry key value
  //
// Call RegDBSetDefaultRoot( ) to set the root key
// to the current value of the the InstallShield
// predefined constant HKEY_USER_SELECTABLE. The value
// of HKEY_USER_SELECTABLE is automatically set to
// HKEY_LOCAL_MACHINE if ALLUSERS is TRUE or 
// HKEY_CURRENT_USER if ALLUSERS is FALSE. 
 
RegDBSetDefaultRoot ( HKEY_USER_SELECTABLE_AUTO );

szKey = "SOFTWARE" ^ IFX_COMPANY_NAME ^ IFX_PRODUCT_NAME;
szName = "TestValueName2";
szValue = "TestValueData2";
nSize = -1;
RegDBSetKeyValueEx ( szKey , szName , REGDB_STRING , szValue , nSize );
   
end;

//---------------------------------------------------------------------------
// OnMaintUIBefore
//
// Maintenance UI Sequence - Before Move Data
//
// The OnMaintUIBefore event is called by OnShowUI when the setup is
// running in maintenance mode. By default this event displays UI that
// allows the end user to add or remove features, repair currently
// installed features or uninstall the application.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//--------------------------------------------------------------------------- 
function OnMaintUIAfter()      
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2,szDirectory1,szDirectory2;     
NUMBER bOpt1, bOpt2; begin   Disable(STATUSEX);            
if( REMOVEALLMODE ) then          
szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);          
szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);            
szTitle="卸载完毕!";                    
szMsg1="已经完全卸载软件系统。";

szDirectory1 = TARGETDIR;

// 卸载我们装载的目录
// D:/PTC/CEAnnotation  //全部的项目根目录
DeleteDir (TARGETDIR^"CEAnnotation", ALLCONTENTS);

szMsg2 ="谢谢您使用我们的软件系统。";               
if ( BATCH_INSTALL ) then       
SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );     
else              
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bOpt1 , bOpt2 );     
endif;
endif;

end;

Installshield工具界面:

InstallShield脚本使用笔记相关推荐

  1. 批处理脚本学习笔记——程序猿版

    批处理脚本学习笔记 原创作品.同意转载,转载时请务必以超链接形式标明文章原始出处.作者信息和本声明.否则将追究法律责任.http://blog.csdn.net/taotaoyouarebaby/ar ...

  2. 批处理脚本学习笔记——程序员版

    批处理脚本学习笔记 原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处.作者信息和本声明.否则将追究法律责任.http://blog.csdn.net/taotaoyouarebaby/ar ...

  3. linux脚本对磁盘分区,shell 脚本实战笔记(4)--linux磁盘分区重新挂载

    背景: Hadoop的HDFS文件系统的挂载, 默认指定的文件目录是/mnt/disk{N}. 当运维人员, 不小心把磁盘挂载于其他目录, 比如/mnt/data, /mnt/disk01, /mnt ...

  4. Shell脚本语言笔记

    Shell脚本语言笔记 一.shell是什么? 二.Shell 是一种脚本语言 1.定义变量 2.单引号和双引号的区别: 3.将命令的结果赋值给变量,常见的有以下两种方式: 4.只读变量 5.删除变量 ...

  5. 关于群晖NAS计划运行Python脚本的笔记

    群晖NAS安装python3及模块 用NAS计划运行python脚本 学习Python时,编了一个小脚本用来每天上几个特定网址,更新数据并用邮件发过来. 由于没有服务器,就用NAS设置计划任务来实现. ...

  6. c语言如何输出字母锥子塔,GCC连接脚本学习笔记 zz

    连接脚本将我整整蒙了1天零一个上午,做了很多实验,看了人家不少例子代码 勉强能驾驭了,让linker按照我想要的来处理,做个笔记. 1,什么叫输入段,什么叫输出段 不知道怎么回事,我对GCC系列的输入 ...

  7. shell脚本学习笔记一

    又开始写学习笔记了,呵呵... 今年打算选择一门技术系统的学习一下.编程语言.虚拟机技术.数据库.大数据.云计算在这些种类中,我选择了shell编程.为什么选择shell呢?也没有什么具体的原因.以前 ...

  8. Python渗透脚本学习笔记

    Python脚本编写 前言 前期准备 脚本代码 目录扫描 SQL注入 简单爆破 总结 前言 最近在B站上学习有关Python编写渗透脚本课程,此篇仅作为学习笔记,代码大部分来自课程讲解,不懂的地方建议 ...

  9. InstallShield 2013 应用笔记(一)

    背景 因项目需要,将最终交付的应用打包成安装程序.在VS2010之前版本,所有安装包制作,我都使用VS自带的安装程序.在VS2010后,因对VS的安装程序维护成本过高,依赖的VBScript脚本语言, ...

  10. shell脚本学习笔记(2)

    Shell脚本笔记 1.最简单的Shell脚本 Shell脚本是以行为单位的,脚本中所包含的成分主要有:注释(#).命令.Shell变量和结构控制语句. 用户可以使用任何文本编辑器编辑Shell脚本文 ...

最新文章

  1. Codeforces Round #504 E. Down or Right
  2. Linux查看本机外网ip
  3. XCTF WEB simple_js
  4. 动态规划生产存储matlab,基于Matlab的动态规划算法的实现及应用
  5. js实现选中文字 分享功能
  6. Keycloak SSO集成到jBPM和Drools Workbench中
  7. Python 错误和异常小结[转]
  8. 神奇的go语言(聊天室的开发)
  9. Java正则表达式例子汇总
  10. 云服务器上传文件到哪个文件夹,云服务器上传到那个文件夹
  11. 关于unity如何制作mmo
  12. Java 流行的工作流引擎
  13. win10桌面显示计算机及网上邻居,Win10网上邻居在哪里Win10桌面显示网络图标的方法...
  14. Detours Hook初探
  15. 解决局域网文件传输慢的问题
  16. 翻译《有关编程、重构及其他的终极问题?》——13.表格化的格式化
  17. manjaro下6.828实验环境配置
  18. 《近匠》AR学校:从教育领域看增强现实机遇何在
  19. Paint滤镜效果 实现各种阴影效果,包括不规则图形
  20. UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xca in position 1869: invalid continuation byte

热门文章

  1. Excel去除含有重复数据所在行
  2. NTSTATUS状态码 详细解说
  3. Glide 的 transformation
  4. 解锁前端密码框常见功能做法
  5. word转pdf加水印以及替换内容
  6. 事业公共基础计算机,2011安徽省事业编公共基础知识(必备资料)
  7. Makerbase_ODrive常见驱动问题及解决
  8. mysql mtq_Mysql 入门学习指南
  9. java安卓模拟器和电脑通信_android模拟器与PC的端口映射
  10. jQuery实现 手风琴图片切换效果( 超简单)