innosetup打包程序脚本
来源:互联网 发布:深圳网络代运营公司 编辑:程序博客网 时间:2024/05/16 14:01
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
;安装包exe的输出路径
#define OutPutDirectory ".\"
;文件路径
#define MyFileDirectory "..\..\install\release\config"
;版本
#define version "1.2.1.2"
;程序名称
#define appname "Tools"
;运行exe名称
#define MyAppExeName "Tools.exe"
;公司网站
#define MyAppURL "http://www.www.com"
;reg path
#define REGPATH "Software\MKT\Config"
;app name
#define APPNAME_CH "设置工具"
#define APPNAME_EN "Tools"
;RUN msg
#define RUNNINGMSG_CH " 正在运行,请先退出!"
#define RUNNINGMSG_EN " is running,please quit first!"
;installed msg
#define INSTALLED_CH "系统检测到其它盘已安装过,请先卸载,或覆盖,位于:"
#define INSTALLED_EN "Detect you have installed in other disk,please uninstall it first or cover it,disk path:"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same App{8CF49867-889C-4534-A2A9-370A362A8DB4}Id value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{53F3A61D-B40C-42DA-B52C-576F27B1864E}
AppName={code:GetAppName}
AppVersion={#version}
AppVerName={#appname} {#version}
DefaultDirName={sd}\{#appname}
DefaultGroupName={#appname}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;使用最低的权限打开
;PrivilegesRequired=lowest
;不用上次安装的路径
UsePreviousAppDir=no
UsePreviousGroup=no
UsePreviousLanguage=no
;输出目录
OutputDir={#OutPutDirectory}
;输出文件名
OutputBaseFilename={#appname} {#version}
Compression=lzma
SolidCompression=yes
VersionInfoVersion={#version}
;提示是否覆盖
DirExistsWarning = yes
;许可证说明
;LicenseFile=compiler:license.txt
;很重要,将显示所有语言
ShowUndisplayableLanguages=yes
[Languages]
Name: "Chinese"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
Name: "English"; MessagesFile: "compiler:Default.isl"
[Messages]
Chinese.BeveledLabel=Chinese
English.BeveledLabel=English
[Tasks]
;创建桌面快捷方式,默认选中
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
;拷贝文件夹及子文件夹的所有文件
Source: {#MyFileDirectory}\*.*; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\{#appname}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#appname}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppExeName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
;卸载前删除安装目录
[UninstallDelete]
;Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{app}\temp"
;安装前先删除
[InstallDelete]
;Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{app}\temp"
Type: filesandordirs; Name: "{app}\unins000.dat"
Type: filesandordirs; Name: "{app}\unins000.exe"
;删除快捷方式
Type: filesandordirs; Name:"{group}\*"
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#appname}}"; Flags: nowait postinstall skipifsilent runascurrentuser
[INI]
Filename: "{app}\config.ini"; Section: "SERVER_SET"; Key: "language"; String: "{code:MyLangName|{app}}"; Flags: uninsdeletesection
[Registry]
Root: HKLM; Subkey: "{#REGPATH}"; ValueType: string; ValueName: path; ValueData: {app}; Flags: createvalueifdoesntexist uninsdeletevalue
[Code]
//默认选择同意(安装的协议)
procedure InitializeWizard();
begin
WizardForm.LICENSEACCEPTEDRADIO.Checked := true;
end;
// 根据选择的语言加载相应的配置文件
function MyLangName(Param : String): String;
begin
Result := ActiveLanguage();
end;
// 获取窗口名称
function GetAppName(Param: String):String;
var
softlan:String;
begin
softlan := MyLangName('');
if (softlan = 'English') then
Result := '{#APPNAME_EN}'
else
Result := '{#APPNAME_CH}';
end;
// 获取警告信息
function GetRunningNotice(Param: String):String;
var
lan:String;
appName:String;
begin
lan := MyLangName('');
appName := GetAppName('');
if (lan = 'English') then
Result := appName + '{#RUNNINGMSG_EN}'
else
Result := appName + '{#RUNNINGMSG_CH}';
end;
// 是否安装过在其它路径下
function IsAppInstallInOtherDisk() : Boolean;
var
res : Boolean;
installpath : String;
softlan : String;
msg : String;
begin
res := True;
if RegQueryStringValue(HKEY_LOCAL_MACHINE, '{#REGPATH}', 'path', installpath) then
if (Uppercase(installpath) <> Uppercase(ExpandConstant('{app}'))) then // 转换为大写比较
begin
res := False;
softlan := MyLangName('');
if (softlan = 'English') then
msg := '{#INSTALLED_EN}'
else
msg := '{#INSTALLED_CH}';
Msgbox(msg + installpath, mbConfirmation, MB_OK);
end;
Result := res;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
res : Boolean;
begin
res := True;
case CurPageID of wpSelectDir:
res := IsAppInstallInOtherDisk();
end;
Result := res;
end;
// 安装时判断客户端是否正在运行
function InitializeSetup(): Boolean;
var
IsRunning: Integer;
name:String;
notice:String;
begin
Result :=true; //安装程序继续
name := GetAppName('');
IsRunning:=FindWindowByWindowName(name);
if IsRunning <> 0 then
begin
notice := GetRunningNotice('');
Msgbox(notice, mbConfirmation, MB_OK);
Result :=false; //安装程序退出
end;
end;
// 卸载时判断客户端是否正在运行
function InitializeUninstall(): Boolean;
var
IsRunning: Integer;
name:String;
notice:String;
begin
Result :=true; //安装程序继续
name := GetAppName('');
IsRunning:=FindWindowByWindowName(name);
if IsRunning <> 0 then
begin
notice := GetRunningNotice('');
Msgbox(notice, mbConfirmation, MB_OK);
Result :=false; //安装程序退出
end;
end;
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
;安装包exe的输出路径
#define OutPutDirectory ".\"
;文件路径
#define MyFileDirectory "..\..\install\release\config"
;版本
#define version "1.2.1.2"
;程序名称
#define appname "Tools"
;运行exe名称
#define MyAppExeName "Tools.exe"
;公司网站
#define MyAppURL "http://www.www.com"
;reg path
#define REGPATH "Software\MKT\Config"
;app name
#define APPNAME_CH "设置工具"
#define APPNAME_EN "Tools"
;RUN msg
#define RUNNINGMSG_CH " 正在运行,请先退出!"
#define RUNNINGMSG_EN " is running,please quit first!"
;installed msg
#define INSTALLED_CH "系统检测到其它盘已安装过,请先卸载,或覆盖,位于:"
#define INSTALLED_EN "Detect you have installed in other disk,please uninstall it first or cover it,disk path:"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same App{8CF49867-889C-4534-A2A9-370A362A8DB4}Id value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{53F3A61D-B40C-42DA-B52C-576F27B1864E}
AppName={code:GetAppName}
AppVersion={#version}
AppVerName={#appname} {#version}
DefaultDirName={sd}\{#appname}
DefaultGroupName={#appname}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;使用最低的权限打开
;PrivilegesRequired=lowest
;不用上次安装的路径
UsePreviousAppDir=no
UsePreviousGroup=no
UsePreviousLanguage=no
;输出目录
OutputDir={#OutPutDirectory}
;输出文件名
OutputBaseFilename={#appname} {#version}
Compression=lzma
SolidCompression=yes
VersionInfoVersion={#version}
;提示是否覆盖
DirExistsWarning = yes
;许可证说明
;LicenseFile=compiler:license.txt
;很重要,将显示所有语言
ShowUndisplayableLanguages=yes
[Languages]
Name: "Chinese"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
Name: "English"; MessagesFile: "compiler:Default.isl"
[Messages]
Chinese.BeveledLabel=Chinese
English.BeveledLabel=English
[Tasks]
;创建桌面快捷方式,默认选中
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
;拷贝文件夹及子文件夹的所有文件
Source: {#MyFileDirectory}\*.*; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\{#appname}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#appname}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppExeName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
;卸载前删除安装目录
[UninstallDelete]
;Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{app}\temp"
;安装前先删除
[InstallDelete]
;Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{app}\temp"
Type: filesandordirs; Name: "{app}\unins000.dat"
Type: filesandordirs; Name: "{app}\unins000.exe"
;删除快捷方式
Type: filesandordirs; Name:"{group}\*"
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#appname}}"; Flags: nowait postinstall skipifsilent runascurrentuser
[INI]
Filename: "{app}\config.ini"; Section: "SERVER_SET"; Key: "language"; String: "{code:MyLangName|{app}}"; Flags: uninsdeletesection
[Registry]
Root: HKLM; Subkey: "{#REGPATH}"; ValueType: string; ValueName: path; ValueData: {app}; Flags: createvalueifdoesntexist uninsdeletevalue
[Code]
//默认选择同意(安装的协议)
procedure InitializeWizard();
begin
WizardForm.LICENSEACCEPTEDRADIO.Checked := true;
end;
// 根据选择的语言加载相应的配置文件
function MyLangName(Param : String): String;
begin
Result := ActiveLanguage();
end;
// 获取窗口名称
function GetAppName(Param: String):String;
var
softlan:String;
begin
softlan := MyLangName('');
if (softlan = 'English') then
Result := '{#APPNAME_EN}'
else
Result := '{#APPNAME_CH}';
end;
// 获取警告信息
function GetRunningNotice(Param: String):String;
var
lan:String;
appName:String;
begin
lan := MyLangName('');
appName := GetAppName('');
if (lan = 'English') then
Result := appName + '{#RUNNINGMSG_EN}'
else
Result := appName + '{#RUNNINGMSG_CH}';
end;
// 是否安装过在其它路径下
function IsAppInstallInOtherDisk() : Boolean;
var
res : Boolean;
installpath : String;
softlan : String;
msg : String;
begin
res := True;
if RegQueryStringValue(HKEY_LOCAL_MACHINE, '{#REGPATH}', 'path', installpath) then
if (Uppercase(installpath) <> Uppercase(ExpandConstant('{app}'))) then // 转换为大写比较
begin
res := False;
softlan := MyLangName('');
if (softlan = 'English') then
msg := '{#INSTALLED_EN}'
else
msg := '{#INSTALLED_CH}';
Msgbox(msg + installpath, mbConfirmation, MB_OK);
end;
Result := res;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
res : Boolean;
begin
res := True;
case CurPageID of wpSelectDir:
res := IsAppInstallInOtherDisk();
end;
Result := res;
end;
// 安装时判断客户端是否正在运行
function InitializeSetup(): Boolean;
var
IsRunning: Integer;
name:String;
notice:String;
begin
Result :=true; //安装程序继续
name := GetAppName('');
IsRunning:=FindWindowByWindowName(name);
if IsRunning <> 0 then
begin
notice := GetRunningNotice('');
Msgbox(notice, mbConfirmation, MB_OK);
Result :=false; //安装程序退出
end;
end;
// 卸载时判断客户端是否正在运行
function InitializeUninstall(): Boolean;
var
IsRunning: Integer;
name:String;
notice:String;
begin
Result :=true; //安装程序继续
name := GetAppName('');
IsRunning:=FindWindowByWindowName(name);
if IsRunning <> 0 then
begin
notice := GetRunningNotice('');
Msgbox(notice, mbConfirmation, MB_OK);
Result :=false; //安装程序退出
end;
end;
阅读全文
0 0
- innosetup打包程序脚本
- 使用InnoSetup打包安装程序
- 使用Innosetup打包程序注册COM组件
- 程序打包软件-innosetup 语法详解
- Innosetup 打包笔记
- InnoSetup 5 脚本
- InnoSetup 打包文件夹的解决方案
- 软件打包部署神器InnoSetup
- InnoSetup 打包文件夹的解决方案
- InnosetUp打包配置多语言
- innosetup 打包工具打包.net framework
- InnoSetup 安装程序制作工具
- 程序打包 之 NSIS脚本
- 关于NSIS脚本打包程序
- 使用Innosetup对软件进行打包
- InnoSetup打包检测.netFramework的问题
- InnoSetup 安装前卸载旧版程序
- 使用Inno SetUp脚本打包Winform程序
- UVa1626
- 三位数的各位数字之和
- 51nod 1418 放球游戏
- LeetCode 120: Triangle
- 服务端指南 数据存储篇 | MySQL(08) 分库与分表设计(转)
- innosetup打包程序脚本
- js传递数组到后台
- 常用连接池
- 剑指offer 二维数组中的查找
- Ctrl+c,Ctrl+d,Ctrl+z在Linux中意义
- 工厂模式之数据库、视图引擎
- [DP] BZOJ4321. queue2
- 欢乐互娱庞池海:《龙之谷》项目性能优化经验分享
- 输入学生人数和成绩并判断出最高分和总分