inno setup 打包脚本相关编辑

1.创建新的GUID

function CoCreateGuid(var Guid:TGuid):integer;
 external '[email protected] 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

 

你可能感兴趣的:(Inno,Setup,Inno,Setup打包,Inno,Setup安装,Inno,Setup脚本编辑)