2014-03-01 24 views

回答

2

要打印出用戶選擇哪些組件,您需要遍歷ComponentsList檢查列表框,檢查該項目是否處於檢查狀態,如果是,請打印其屬性,最有可能是ItemCaption。下面的腳本顯示瞭如何將選定的組件數作爲一個簡單的列表:

[Code] 
procedure CurStepChanged(CurStep: TSetupStep); 
var 
    I: Integer; 
begin 
    if CurStep = ssInstall then 
    begin 
    Log('Selected components:'); 

    for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do 
     if WizardForm.ComponentsList.Checked[I] then 
     Log('Component: ' + WizardForm.ComponentsList.ItemCaption[I]); 
    end; 
end; 

而一個Inno Setup的組件腳本示例日誌在IDE中的截圖:

enter image description here

+0

感謝您的答覆,但有有什麼方法可以將它保存在txt文件中? – DeXon

+1

當然,有。但在我們繼續之前,這個日誌的目標是什麼?它是否僅用於記錄選定的組件?它只會用於閱讀,還是會以某種方式處理存儲的結果?我的意思是,如果輸出的形式是可以看到的,這就夠了嗎? – TLama

+0

目標是幫助有問題的人安裝時,所以我需要知道他們選擇了什麼。 – DeXon