10)使用ISMP 11.5的project file
ISMP 11.5的project file是uip格式的,IA不能直接打開它。我們可以在ISMP 11.5中導出一種DIM file,然后在
IA的organization-->DIM Reference-->add DIM Reference中使用它。ISMP 11 sp1之前的版本IA不再兼容
11)installer運行時參數
你可以在installer運行的時候添加一些參數,比如
installer.exe -i console //在console模式下運行
//在silent模式下運行,由于silent模式不會有任何界面,所以你可以
//設置一些安裝的屬性,格式如下:
installer.exe -i silent <propertyname>=<value>
//具體實例:
installer.exe -i silent USER_INSTALL_DIR=C:\Mydirectory
//如果你屬性很多,你可以都寫在一個文件中,然后引用就可以了
installer.exe -i silent -f <path to the properties file>
12)用代碼啟動IA的build
稍微復雜一點的java項目在編譯打包的時候都少不了要用到ant。如果我們要在ant中啟動IA來制作安裝程序該怎么做呢
IA的安裝目錄下有一個build.exe,用它就可以了。
build.exe <path to IA project file>
13)source path
在Edit菜單里面可以設置source path。感覺它跟ISMP的alias是一樣的。無非就是讓你設置IA_HOME,PROJECT_HOME等等。
和alias不同的是,source path都是global,沒有project類型的。source path存放在C:\Documents and Settings\Administrator\InstallAnywhere\80\Enterprise\preferences中
14)merge modules
當我們需要有一個project包含其他project的時候,就要用到merge modules。最典型的例子就是office包含word,powerpoint
,excel等。merge modules最少要有兩個project,一個parent project,若干個child project。merge modules主要有以下幾種:
i. design time merge module
這種merge module直接把child project拷貝到了parent project中,child project中的panel和action都會在parent project
的安裝過程中出現,并且你可以在parent project中修改它們。如果原來的child project做了某些變化,parent project中的child project不會有任何變化。
這種merge module只生成一個uninstaller,它會卸載掉整個軟件產品。如果要只卸載child project,好像可以通過把child project
設成feature來實現,但我目前還沒有實驗過。
ii. dynamic time merge module
這種merge module不拷貝child project到parent project中,它只鏈接到child project。所以child project的任何變化都會反映到
parent project中。但是你不能在parent project中修改child project的panel和action,因為你只是鏈接到child project。
這種merge module會生成多個uninstaller,分別用來卸載parent project 和child projects。
iii. build time merge module
和dynamic time merge module類似,不同的是build time merge module不會出現child project的panel。換句話說,child project是以silent模式安裝的。
怎么在具體的項目中用merge module呢?首先,你需要把child project build成merge module,會生成一個文件。然后在parent project的
orgnization-->Modules 導入就可以了
15)Custom Code
IA的advanced designer已經可以滿足大部分用戶的需要了,如果你所要的功能advanced designer還無法實現,你可以自己編寫Custom Code來實現。可以說
Custom Code是IA的more advanced designer。
Custom Code分成以下幾種:
i.custom code actions
ii.custom code panels
iii.custom code consoles
iv.custom code rules
在IA的安裝目錄下有一個javadoc目錄,里面有IA提供的api的文檔,跟java的api的文檔的使用方法是一樣的。IA為以上四種Custom Code提供了四個
缺省的類來實現,分別是CustomCodeAction,CustomCodePanel,CustomCodeConsoleAction,CustomCodeRule,你可以去繼承它們并添加你需要的
功能。
代碼寫好了之后不能直接用于IA中,還需要編譯,打包。打包有兩種方法
一)打包成類的JAR包
先寫好代碼,然后用javac命令編譯(當然你也可以用eclipse,netbean來得到class文件),最后把class file壓成jar包。
點擊Add Action-->Execute Custom Code,指定你的jar包的位置,如果用到了第三方的jar包,記得把它們添加到“Dependencies”中
ps:點擊Add Action,你會看到有四個tab:General,Panels,Consoles,Plug-ins。如果你是Custom Code Action,要選擇General里面的
Execute Custom Code,如果你是custom code panels,你要選擇Panels里面的Execute Custom Code,如果是custom code consoles,
要選擇Consoles里面的Execute Custom Code,如果是custom code rules,不能通過Add Action添加,你需要點擊Add Rule-->evaluate custom code
來執行
二)打包成plugin
先寫好代碼,然后用javac命令編譯(當然你也可以用eclipse,netbean來得到class文件)。
創建一個properties文件,然后把這個properties文件打包成一個jar包。可見與第一種方法的區別就是多了一個屬性文件
舉一個屬性文件的例子:
plguin.name=my custom action
plugin.main.class=MySampleAction
plugin.type=action
//如果你寫了preinstall,那在preinstall view中Add Action-->Plugin里面可以看見這個plugin,否則是看不見的。
plugin.available=preinstall,install,postinstall
//property.myproperty=this value
property.database=localhost
打包完成后,把jar包拷貝到IA安裝目錄下的plugins文件夾,然后重啟IA(eclipse的用戶肯定很熟悉這個操作吧,呵呵)
然后你就可以在Add Action-->Plug-Ins里面發現你自己寫的plugin了。
最后列一下IA提供的api中比較重要的方法(IA提供了一個zip包IAClasses.zip在IA安裝目錄下)
public class MySampleAction extends CustomCodeAction
{
public void install(InstallerProxy ip)
{
}
}
subsititue(String var)-recursively gets the variable value
getVariable(String var)- jaut gets the variable value
for example:
database_name=$user_install_dir$/mydir
subsititue(String var) C:\pf\macrovision\mydir
getVariable(String var)
$user_install_dir$/mydir
public class MyCustom Panel extend CustomCodePanel{
public boolean setupUI(CustomCodePanelProxy ccpp){
//execute some condition or logic
return true or false;//if true ,display,or don't display
public voidpanelIsDisplayed()
{//you will put controls and logic for displaying the panel
//this is where you will use java's swing classes to display controls on your dialogs
//just for text area,if you wanna add a button to the bottom,then you need
//to create a new dialog by swing ,
}
public boolean okToContinue()
{
}
}
}
public class MyCustomConsole extend CustomCodeConsoleAction{
public boolean setup(CustomCodePanelProxy ccpp){
//any validation you want to execute before displaying this console panel
you will put here
}
}
}
public class MyCustomRule extends CustomCodeRule{
public void evaluateRule()
{
//in this method,you can put the logic to evaulate this custom rule
//return true or false
}
}
}
在IA安裝目錄下的Custom Code文件夾,你可以找到一些sample code,更多的sample code可以到
它的網站上查詢。
最后,引用training teacher的一句話作為本文的結尾“不管你的產品有多好,用戶第一印象是看你的安裝程序,如果你的安裝程序不夠人性化,甚至安裝失敗了,那用戶對它的評價就不會高”