Inno Setup唯一打包安装脚本示范

Inno Setup唯一打包安装脚本示范.2008-03-18 17:40; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文档的详细资源请查阅帮助文档!
[Setup]
; 注: AppId的值为单独标识该实际运用程式。
; 不能为更多有联系安装程式应用相同的AppId值。
; (生成新的GUID,点击 道具|在IDE中生成GUID。)
AppId={{A9861883-31C5-4324-BD9A-DC3271EEB675}
;程式名
AppName=ISsample
;版本号
AppVerName=ISsample 1.0.0.0
;正式发布者名
AppPublisher=Hkiss
;有联系连接
AppPublisherURL=http://www.yan.com/
AppSupportURL=http://www.yan.com/
AppUpdatesURL=http://www.yan.com/
;默认安装列表
DefaultDirName={pf}/ISsample
;默认开端菜单名
DefaultGroupName=ISsample
;也许打开->可选安装开端菜单项
;AllowNoIcons=yes
;安装规则
;LicenseFile=C:/Example/原始文档/agreement.txt
;安装前查看的文档文档
;InfoBeforeFile=C:/Example/原始文档/Setup_New.txt
;安装后查看文档文档
;InfoAfterFile=C:/Example/原始文档/Setup_Old.txt
;输出文档夹
OutputDir=C:/Example/InnoSetup/out
;输出文档名
OutputBaseFilename=setup
;安装图标
SetupIconFile=C:/Example/原始文档/title.ico
;安装需求输入密码
;Password=123
;Encryption=yes
;压缩有联系
Compression=lzma
SolidCompression=yes
;能够让用户忽略选取语句语言有联系
ShowLanguageDialog = yes
;备注版本消息
VersionInfoCompany=HTTP://www.Hkiss.COM
VersionInfoDescription=ISsample 汉化增强版
VersionInfoVersion=1.0.0.0
VersionInfoCopyright=Copyright (C) 2007-2008 Hkiss
;制作选取语句语言
[Languages]
Name: "chs"; MessagesFile: "compiler:Default.isl" ;LicenSeFile :"C:/Example/原始文档/chs/agreement.txt"
Name: "en"; MessagesFile: "compiler:Languages/English.isl";LicenSeFile :"C:/Example/原始文档/en/agreement.txt"
;用户定制任务
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "Tasks_1" ; Description:"用户自定义任务1"; Flags: unchecked
Name: "Tasks_2" ; Description:"用户自定义任务2"; Flags: unchecked
;选取了组件才会呈现的定制任务
Name: "Tasks_3" ; Description:"用户自定义任务3";Components: c1 ; Flags: unchecked
;文档安装
[Files]
;多语句语言安装环境设置 社交参数parameterLanguages 来设置
Source: "C:/Example/原始文档/enfile.txt"; DestDir: "{app}"; Languages: en ; Flags: ignoreversion
Source: "C:/Example/原始文档/chsfile.txt"; DestDir: "{app}"; Languages: chs ; Flags: ignoreversion
;用户自定义任务 Tasks
Source: "C:/Example/原始文档/Tasks/tasks_1.txt"; DestDir: "{app}/Tasks"; Flags: ignoreversion ;Tasks : Tasks_1
Source: "C:/Example/原始文档/Tasks/tasks_2.txt"; DestDir: "{app}/Tasks"; Flags: ignoreversion ;Tasks :Tasks_2
Source: "C:/Example/原始文档/Tasks/tasks_Components.txt"; DestDir: "{app}/Tasks"; Flags: ignoreversion ;Tasks :Tasks_2
;用户定义组件安装
Source: "C:/Example/原始文档/Components/Components_1.txt"; DestDir: "{app}/Components"; Flags: ignoreversion ; Components: a1;
Source: "C:/Example/原始文档/Components/Components_2.txt"; DestDir: "{app}/Components"; Flags: ignoreversion ; Components: a2;
Source: "C:/Example/原始文档/Components/Components_3.txt"; DestDir: "{app}/Components"; Flags: ignoreversion ; Components: a3;
Source: "C:/Example/原始文档/Components/Components_4.txt"; DestDir: "{app}/Components"; Flags: ignoreversion ; Components: a1 a2 a3;
;用户注册自定义Dll文档 regserver 注册 noregerror 不呈现错误消息
Source: "C:/Example/原始文档/jmail.dll"; DestDir: "{app}"; Flags: ignoreversion regserver
;添加自述文档
Source: "C:/Example/原始文档/ISsample.txt"; DestDir: "{app}"; Flags: ignoreversion
;添加唯一文档到缓存文档夹{Tmp} deleteafterinstall 安装后删除
Source: "C:/Example/原始文档/test.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall
Source: "C:/Example/原始文档/ISsample.chm"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:/Example/原始文档/ISsample.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:/Example/原始文档/ISsample.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:/Example/原始文档/ISsample.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:/Example/原始文档/ISsample.rar"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:/Example/原始文档/ISsample_sys.dll"; DestDir: "{win}/System32"; Flags: ignoreversion
Source: "C:/Example/原始文档/log/*"; DestDir: "{app}/log"; Flags: ignoreversion recursesubdirs createallsubdirs
; 留意: 不能在任何共享操作系统文档上应用“Flags: ignoreversion”
;安装类别设置
[Types]
Name: Full ;Description:"完全安装"; Flags: iscustom
Name: Compact ;Description:"简洁安装";
Name: Custom; Description:"自定义安装";
;组件安装
[Components]
Name: c1; Description: "自定义任务3" ; Types: Full
Name: a1; Description: "安装Components_1"; Types: Full Compact Custom ;
Name: a2; Description: "安装Components_2"; Types : Full Compact
Name: a3; Description: "安装Components_3"; Types : Full
;开端菜单,桌面快捷方法
[Icons]
Name: "{group}/ISsample"; Filename: "{app}/ISsample.exe"
Name: "{group}/{cm:ProgramOnTheWeb,ISsample}"; Filename: "http://www.yan.com/"
Name: "{group}/{cm:UninstallProgram,ISsample}"; Filename: "{uninstallexe}"
Name: "{commondesktop}/ISsample"; Filename: "{app}/ISsample.exe"; Tasks: desktopicon
Name: "{userappdata}/Microsoft/Internet Explorer/Quick Launch/ISsample"; Filename: "{app}/ISsample.exe"; Tasks: quicklaunchicon
;添加唯一帮助文挡
Name: {group}/ISsample 1.0.0.0 帮助文档;Filename: {app}/ISsample.chm
;用来在程式安装完成后 在安装程式呈现最终对话框之前执行程式 日常与运行主程式 呈现自述文档 删除临时文档
[Run]
Filename: "{app}/ISsample.exe"; Description: "{cm:LaunchProgram,ISsample}"; Flags: nowait postinstall skipifsilent
Filename: "{app}/ISsample.txt"; Description: "查看呈现自述文档"; Flags: postinstall skipifsilent shellexec
;更改呈现在程式中呈现的消息文档
[Messages]
BeveledLabel=HKiss科技
;卸载对话框说明
ConfirmUninstall=您真的想要从电脑中卸载ISsample吗?%n%n按 [是] 则完全删除 %1 以及它的所有组件;%n按 [否]则让热门软件继续留在您的电脑上.
;定义解压说明
;StatusExtractFiles=解压并复制主程式文档及有联系库文档...
;用与在用户操作系统中创建,改正或删除注册表健值
[Registry]
Root: HKLM ;SubKey:"Software/ISsample";ValueType:dword;ValueName:config;ValueData:10 ;Flags:uninsdeletevalue
;在执行脚本
[code]
//全局变量
var MyProgChecked: Boolean;
//判断程式也许存在

//初始华程式事件
function InitializeSetup(): boolean;
var Isbl: boolean; //声明变量
var Isstr: string;
begin //开端
Isbl := true; //变量赋值
Isstr := '欢迎';
if RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE/ISsample', 'config') then
begin
MsgBox('已安装过,请先卸载在安装',mbConfirmation, MB_OK);
isbl := false;
end else
begin
//MsgBox('无值',mbConfirmation, MB_OK);
isbl := true;
end;
//下面是个麻烦的 要求语句 end else 留意
//if MsgBox(Isstr, mbConfirmation, MB_OKCANCEL) = IDOK then
//begin
// isbl := true;
// MsgBox('执行了', mbConfirmation, MB_OK);
//end else
//begin
// isbl := false;
//MsgBox('执行了', mbConfirmation, MB_OK);
//end;
Result := Isbl;
end; //结束
procedure CurStepChanged(CurStep: TSetupStep);
var Isstr :string;
begin
if CurStep=ssInstall then //实际安装前调用
begin
//MsgBox('CurStepChanged:实际安装前调用', mbConfirmation, MB_OKCANCEL); //安装完成后调用
end;
if CurStep=ssPostInstall then
begin
Isstr := ExpandConstant('{tmp}/tmp.rar');
// if FileExists(Isstr) then
// begin
// MsgBox('文档存在',mbConfirmation, MB_OK);
// end else
// begin
// MsgBox('文档不存在',mbConfirmation, MB_OK);
// end;
// MsgBox('CurStepChanged:实际安装后调用', mbConfirmation, MB_OKCANCEL);
end;
end;
//下一步 按钮按钮 事件
function NextButtonClick(CurPageID: Integer): Boolean;
var ResultCode: Integer;
var IsSetup : Boolean;
begin
IsSetup := true ;
case CurPageID of
wpSelectDir:
MsgBox('NextButtonClick:' #13#13 'You selected: ''' + WizardDirValue + '''.', mbInformation, MB_OK); //WizardDirValue路径
wpSelectProgramGroup:
MsgBox('NextButtonClick:' #13#13 'You selected: ''' + WizardGroupValue + '''.', mbInformation, MB_OK); //开端菜单名
wpReady:
begin
if not RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE/Test', 'config') then begin
if MsgBox('程式执行需求Test.ext,也许安装!', mbConfirmation, MB_YESNO) = idYes then begin
ExtractTemporaryFile('test.exe');
if not Exec(ExpandConstant('{tmp}/test.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then
MsgBox('Test.exe出错:' #13#13 ' ' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);
end else begin
IsSetup := false ;
end ;
BringToFrontAndRestore();
end;
end;
end;
Result := IsSetup;
end;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值