0
votes

I am new to NSIS Script and creating installers.

In My page there is a text box. While the page loading the text box show the value of reading the text from one text file. I want to know how to do this Using NSIS Scripts.. Need code samples...

1
Mind showing some code ? - foobar

1 Answers

0
votes
Function .onInit
InitPluginsDir
FileOpen $0 "$pluginsdir\text.txt" w ; Normally the text file would come from a File command
FileWrite $0 "Hello World$\r$\nfrom$\r$\nNSIS$\r$\n" ; Add some dummy text
FileClose $0
FunctionEnd

Page Custom MyCustomPageInit
Page InstFiles

Var TxtCtl

!include nsDialogs.nsh
!include LogicLib.nsh

Function MyCustomPageInit
nsDialogs::Create 1018
Pop $0

!define MYMULTILINEEDIT_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_MULTILINE}|${ES_READONLY}
nsDialogs::CreateControl EDIT ${MYMULTILINEEDIT_STYLE} ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} 5% 10u 90% 50% ""
Pop $TxtCtl

FileOpen $0 "$pluginsdir\text.txt" r
loop:
    FileRead $0 $1 ; Read a line
    IfErrors eof
    SendMessage $TxtCtl ${EM_REPLACESEL} 0 "STR:$1$\n"
    Goto loop
eof:
FileClose $0

nsDialogs::Show
FunctionEnd