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;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章