jens_lynild
2nd January 2007 10:54 UTC
Problem with NSIS install
Hi
I have a problem with the install file I have made with NSIS. When I make the exe file it all works fine and I can run the Install shield and then the program that I want to install is installed. But then I place the file on a ftp server and something goes wrong. I can download the file but when I go through some of the custom made windows the install wizard freezes just before it should start installing the files. Is there any one that has had the same problem and knows how to fix it?
Red Wine
2nd January 2007 14:06 UTC
when I go through some of the custom made windows the install wizard freezes
I suppose by that you mean that your installer includes InstallOptions custom page(s). If this is indeed the case, verify that you've include the proper ini for each custom page, and that the ini is extracted and called properly.
e.g.
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\custom.ini custom.ini
FunctionEnd
Section -
ReadIniStr $R0 '$PLUGINSDIR\custom.ini' 'Field 1' 'State'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'State' 'boo'
jens_lynild
2nd January 2007 14:59 UTC
This is how I have used the custom page:
; Customer page
Page custom SetCustom ValidateCustom
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
When I press on install from the page det install wizard freezes.
the .onInit look like this
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
I don't know way the wizard stopped working.
Backland
2nd January 2007 15:01 UTC
yes, not extracting to $PLUGINSDIR can cause many issues, so you might want to check that all external files referenced in your code are properly extracted.
Red Wine
2nd January 2007 15:06 UTC
If you don't mind attach the script, only the 2 functions SetCustom ValidateCustom.
jens_lynild
2nd January 2007 15:15 UTC
Function SetCustom
!insertmacro MUI_HEADER_TEXT "$(LABEL_TITEL)" ""
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "Custom.ini"
!insertmacro MUI_INSTALLOPTIONS_WRITE "Custom.ini" "Field 1" "Text" "$(LABEL_NAME)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "Custom.ini" "Field 2" "Text" "$(LABEL_NAME_TEXT)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "Custom.ini"
FunctionEnd
Function ValidateCustom
ReadINIStr $0 "$PLUGINSDIR\Custom.ini" "Field 3" "State"
StrCmp $0 "" message1 done
message1:
MessageBox MB_ICONEXCLAMATION|MB_OK "$(LABEL_MESSAGE1)"
Abort
done:
${GetTime} "" "LS" $3 $4 $5 $6 $7 $8 $9
ClearErrors
FileOpen $2 $INSTDIR\Programs\ls.ini w
IfErrors done
FileWrite $2 "#X © Defaults$\r$\n"
FileWrite $2 "#Date=$3/$4/$5 ($6)Time=$7:$8:$9$\r$\n"
FileWrite $2 "Name=$0$\r$\n"
${WordReplace} $INSTDIR "\" "/" "+" $3
FileWrite $2 "defaultDataDir=$3/Data$\r$\n"
FileWrite $2 "Company=X$\r$\n"
StrCmp "1030" "$LANGUAGE" languageWriteDK languageWriteEN
languageWriteDK:
FileWrite $2 "defaultLanguage=da"
Goto close
languageWriteEN:
FileWrite $2 "defaultLanguage=en"
Goto close
close:
FileClose $2
FunctionEnd
Red Wine
2nd January 2007 15:26 UTC
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\custom.ini custom.ini
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function SetCustom
!insertmacro MUI_HEADER_TEXT "$(LABEL_TITEL)" ""
WriteIniStr "$PLUGINSDIR\Custom.ini" "Field 1" "Text" "$(LABEL_NAME)"
WriteIniStr "$PLUGINSDIR\Custom.ini" "Field 2" "Text" "$(LABEL_NAME_TEXT)"
push $R0
InstallOptions::Dialog "$PLUGINSDIR\Custom.ini"
pop $R0
pop $R0
FunctionEnd
EDIT:
Also I noticed that you're referring $INSTDIR on ValidateCustom function.
$INSTDIR has to be initialized either in directory page (that you probably already had before the custom page), or in InstallDir if you don't include directory page.
jens_lynild
2nd January 2007 15:39 UTC
It seams to work but I will try to test it some on another machine tomorrow thanks for the help :)