Old 23rd September 2010, 13:09   #1
USERDPRO
Junior Member
 
Join Date: Sep 2010
Posts: 5
How to make a NSIS installations in separated files

Hi all,

I'm working in a NSIS installation that has a "main" (setup.nsi) file with the order of my custom pages (I'm using MUI2 and InstallOptions) . In setup.nsi I include a .nsh file that have the Create/Leave functions for a Custom Page.

I want to create a macro that pops up a message box if any input text is empty (macro FORCE_NOT_EMPTY_TEXT). When I compile I get warnings because of the macro and the parameters of the macro are empty (void string):

Quote:
3 warnings:
LangString "field" is not set in language table of language English
LangString "dialog" is not set in language table of language English
LangString "message" is not set in language table of language English
Any suggestions?

thank you in advance


Macro:

PHP Code:
!macro FORCE_NOT_EMPTY_TEXT dialog field message

    
!insertmacro INSTALLOPTIONS_READ $$(dialog) $(field"State"
    
${if} $== ""  
        
MessageBox MB_ICONEXCLAMATION|MB_OK $(messageIDOK
        abort
    
${endif}
!
macroend 
SETUP.NSI file:

PHP Code:

# Included files
!include Sections.nsh
!include MUI2.nsh
!include InstallOptions.nsh
!include DialogIMAPConfiguration.nsh ; <<<<< include custom dialog implementation
!include DialogIMAPFolders.nsh
!include DialogSMTP.nsh

# Reserved Files
ReserveFile "${NSISDIR}\Plugins\System.dll"

# Variables
Var StartMenuGroup

# Installer pages
!insertmacro MUI_PAGE_WELCOME

Page custom CreateDialogIMAPConfiguration LeaveDialogIMAPConfiguration  
; <<<< my custom page

Page custom CreateDialogIMAPFolders

Page custom CreateDialogSMTP

!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

# Installer languages
!insertmacro MUI_LANGUAGE "English" ; <<<<<<<<<  language definition 
Custom Page "implementation": $(DIALOG_IMAP) and $(TXT_LOGIN_DIFFERENT) are LangString

PHP Code:
Function CreateDialogIMAPConfiguration
  
!insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE)
  !
insertmacro INSTALLOPTIONS_DISPLAY $(DIALOG_IMAP)
FunctionEnd


Function LeaveDialogIMAPConfiguration
        
    
!insertmacro INSTALLOPTIONS_READ $$(DIALOG_IMAP"Settings" "State"
    
${if} $== LOGICA DE VALIDACION

        
!insertmacro INSTALLOPTIONS_READ $$(DIALOG_IMAP) $(CHK_LOGIN_DIFFERENT"State"
        
${if} $== 1  
            
            
!insertmacro FORCE_NOT_EMPTY_TEXT  $(DIALOG_IMAP)  $(TXT_LOGIN_DIFFERENT"Different login needed."       ; <<<<<<<< using the macro...

        ${endif}    
        
    ${else}   
    

        !
insertmacro INSTALLOPTIONS_READ $$(DIALOG_IMAP) $(CHK_LOGIN_DIFFERENT"State"
        
${if} $== 1
            
!insertmacro INSTALLOPTIONS_READ $$(DIALOG_IMAP) $(TXT_LOGIN_DIFFERENT"HWND"
             
EnableWindow $0 1       
        
${else}
              !
insertmacro INSTALLOPTIONS_READ $$(DIALOG_IMAP) $(TXT_LOGIN_DIFFERENT"HWND"
               
EnableWindow $0 0
        
${endif}
   
        
abort
    
${endif}  
    
 
FunctionEnd 
USERDPRO is offline   Reply With Quote
Old 23rd September 2010, 15:13   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
You are using LangStrings ( in parentheses ) where I think you're looking for defines (in curly braces )

PHP Code:
!macro FORCE_NOT_EMPTY_TEXT dialog field message
    
!insertmacro INSTALLOPTIONS_READ $${dialog} ${field"State"
    
${if} $== ""  
        
MessageBox MB_ICONEXCLAMATION|MB_OK ${messageIDOK
        abort
    
${endif}
!
macroend 
Animaether is offline   Reply With Quote
Old 24th September 2010, 12:54   #3
USERDPRO
Junior Member
 
Join Date: Sep 2010
Posts: 5
Now I am using !defines instead of LangStrings to avoid the language table check and works fine. Thank you Animaether.
USERDPRO is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump