inno setup 打包脚本相关编辑

1.创建新的GUID

function CoCreateGuid(var Guid:TGuid):integer;
 external 'CoCreateGuid@ole32.dll stdcall';
 
function inttohex(l:longword; digits:integer):string;
var hexchars:string;
begin
 hexchars:='0123456789ABCDEF';
 setlength(result,digits);
 while (digits>0) do begin
  result[digits]:=hexchars[l mod 16+1];
  l:=l div 16;
  digits:=digits-1;
 end;
end;
 
function GetGuid(dummy:string):string;
var Guid:TGuid;
begin
  if CoCreateGuid(Guid)=0 then begin
  result:='{'+IntToHex(Guid.D1,8)+'-'+
           IntToHex(Guid.D2,4)+'-'+
           IntToHex(Guid.D3,4)+'-'+
           IntToHex(Guid.D4[0],2)+IntToHex(Guid.D4[1],2)+'-'+
           IntToHex(Guid.D4[2],2)+IntToHex(Guid.D4[3],2)+
           IntToHex(Guid.D4[4],2)+IntToHex(Guid.D4[5],2)+
           IntToHex(Guid.D4[6],2)+IntToHex(Guid.D4[7],2)+
           '}';
  end else
    result:='{00000000-0000-0000-0000-000000000000}';
end;

 

2.获取本地日期

function GetSystemDataTimeString(Param: String): string;
begin
result := GetDateTimeString('yyyy/mm/dd hh:nn:ss', '-', ':');
end;

 

3.编辑ini文件

[INI]
Filename: "{app}\SysConfig.ini"; Section: "System";Key: "GUID"; String: {code:GetGuid}
Filename: "{app}\SysConfig.ini"; Section: "System";Key: "SysTime"; String: {code:GetSystemDataTimeString}

4.打包多个启动exe程序

#define MyAppName "程序名称1"
#define MyAppVersion "1.0.2021.0116"
#define MyAppPublisher "公司"
#define MyAppURL "公司网站"
#define MyAppExeName "exe程序1"
#define MyAppSevName "程序名称2"
#define MyAppSevExeName "exe程序2"

;桌面
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{autoprograms}\{#MyAppSevName}"; Filename: "{app}\{#MyAppSevExeName}"
Name: "{autodesktop}\{#MyAppSevName}"; Filename: "{app}\{#MyAppSevExeName}"; Tasks: desktopicon

;启动程序
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Filename: "{app}\{#MyAppSevExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppSevName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值