2011-09-21 187 views
0

在我的NSIS安裝程序中,我想向用戶顯示一個輸入對話框(text + textbox)並檢索該輸入的結果,以便稍後在NSIS腳本中使用它。NSIS中的簡單輸入對話框

我發現這個參考頁:

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.4.15

但我無法找到一個文本框的任何引用。

如果有幫助,我需要的是NSIS相當於下面的AppleScript代碼:

display dialog "Insert value:" default answer "" 
set value to text returned of result 

回答

1

使用nsDialogs或InstallOptions(NSIS的兩部分)來創建自定義頁面:

Outfile test.exe 
Requestexecutionlevel user 

!include nsDialogs.nsh 

Page Custom mypagecreate mypageleave 
Page Instfiles 

Function mypagecreate 
Var /Global MyTextbox 
nsDialogs::Create /NOUNLOAD 1018 
Pop $0 
${NSD_CreateText} 10% 20u 80% 12u "Hello World" 
Pop $MyTextbox 
nsDialogs::Show 
FunctionEnd 

Function mypageleave 
${NSD_GetText} $MyTextbox $0 
MessageBox mb_ok $0 
Abort ;Don't move to next page (If the input was invalid etc) 
FunctionEnd 

Section 
SectionEnd 

彈出對話框不是真的支持,但可以使用this plugin ...