2011年10月10日 星期一

Inno Setup - 進階設定

1. 修改安裝過程的圖片

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Caspar_Calc"
#define MyAppVersion "1.0"
#define MyAppPublisher "Caspar Company, Inc."
#define MyAppURL "http://ccd9527.blogspot.com"
#define MyAppExeName "Calc.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{9436BBE4-5C37-413F-9D7D-92F4B8EB131B}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
WizardImageFile=D:\Release\Inno Setup\install.bmp
WizardSmallImageFile=D:\Release\Inno Setup\install2.bmp

AppVerName={#MyAppName} {#MyAppVersion}
(以下略)

圖片限定使用bmp且大小上限是164x314 pixels
WizardImageFile變數是顯示一開始安裝的第一個畫面~


圖片限定使用bmp且大小上限是55x58 pixels
WizardSmallImageFile的部分是設定安裝右上角的小圖


2. 指定壓縮方式
在[Setup]區段可以選擇壓縮的方式
在說明檔裡面,有以下的值可以使用
zip
zip/1 through zip/9
bzip
bzip/1 through bzip/9
lzma
lzma/fast
lzma/normal
lzma/max
lzma/ultra (review memory requirements below before using)
lzma/ultra64 (review memory requirements below before using)
lzma2
lzma2/fast
lzma2/normal
lzma2/max
lzma2/ultra (review memory requirements below before using)
lzma2/ultra64 (review memory requirements below before using)
none
Default value:
lzma2/max

預設是使用lzma2/max
zip壓縮方式比較快,而且需要記憶體的空間比較小
lzma2是使用7z的演算法,壓縮效率比較好,但是,需要的時間與記憶體空間比較多

3. 為要執行的檔案建立捷徑
在[Icons]的區段加入以下的內容
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";WorkingDir: "{app}"; IconFilename: "D:\Release\Inno Setup\OA6.ico"; Comment: "快捷方式"



4. 安裝完後,顯示ReadMe文件
在[Files]區段裡面ReadMe文件最後的Flags設定isreadme
而且一次可以輸入多個ReadMe檔案
Source: "D:\Release\Inno Setup\ReadMe.txt"; DestDir: "{app}";Flags:isreadme
Source: "D:\Release\Inno Setup\ReadMe_Doc.doc"; DestDir: "{app}";Flags:isreadme



5. 在程式安裝目錄下,建立一個資料夾
在[Files]區段輸入以下內容
Name: "{app}\WorkDir"

這樣在安裝後,會建立WorkDir的資料夾


當然這個文件夾是空白的,一般可用來作為初始工作的目錄或者保存結果的目錄。
另外,上面的這種情況下,如果移除程式,該資料夾會被如何處理呢?
1.如果資料夾是空白的,該資料夾會被刪除。
2.如果資料夾非空,該資料夾會被保留

6. 有選擇性的安裝元件
[Components]
Name: main; Description: "主程式(必選)"; Types:full compact custom; Flags: fixed
Name: help; Description: "說明檔"; Types: full

[Files]
Source: "D:\Release\Calc.exe"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\libgcc_s_dw2-1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\mingwm10.dll"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\QtCore4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\QtCored4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\QtGui4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\QtGuid4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components:main
Source: "D:\Release\Inno Setup\ReadMe.txt"; DestDir: "{app}";Flags:isreadme; Components:help
Source: "D:\Release\Inno Setup\ReadMe_Doc.doc"; DestDir: "{app}";Flags:isreadme; Components:help
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

在[Components]定義有哪一些Components的類別,
並且可以透過fixed關鍵字,來表示一定要安裝的元件
另外,在[Files]在最後,可以用Components來表示是屬於哪一類Components


參考資料:
Inno Setup入門(一) - 最簡單的安裝腳本
Inno Setup入門(十) -- 操作注冊表

沒有留言: