emdiouf
16th May 2005 10:11 UTC
Problem to have two Directory Page !
Hi everybody,
I would like to have two Directory Page for my installer; one for the
Application and another for the Data Base :
i have found in the archive some examples and try to adapt them but it don't work.
Here is part of my code :
Var AppliDir
Var DataDir
function .onInit
strCpy $AppliDir "c:\myAppli"
strCpy $DataDir "c:\myData"
functionEnd
PageEx directory
#customization of the page
PageCallbacks appliPre
PageExEnd
PageEx directory
#customization of the page
PageCallbacks dataPre
PageExEnd
function appliPre
# Display Appli Directory Page if and only if Section1 #or Section2 are selected
SectionGetFlags Section1 $R1
IntOp $R1 $R1 & ${SF_SELECTED}
SectionGetFlags Section2 $R2
IntOp $R2 $R2 & ${SF_SELECTED}
Intop $R3 $R1 | $R2
IntCmp $R3 ${SF_SELECTED} displayPageAppli
Abort
displayPageAppli:
functionEnd
function dataPre
# Display Data Directory Page if and only if Section4 #is selected
SectionGetFlags Section4 $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} displayPageDB
Abort
displayPageDB:
functionEnd
SubSection "mySubsection1"
Section "Section1" SEC1
SetOutPath $AppliDir
#put files here
SectionEnd
Section "Section2" SEC2
SetOutPath $AppliDir
#put files here
SectionEnd
Section "Section3" SEC3
SetOutPath $AppliDir
#put files here
SectionEnd
SubSectionEnd
SubSection "mySubsection2"
Section "Section4" SEC4
SetOutPath $DataDir
#put files here
SectionEnd
SubsectionEnd
What I would like :
1)display the Appli directory if and only if one of Section1 or Section2
or the two sections are selected; in other cases not to display the Appli Directory
2)display the Data directory if and only if Section4 is selected; in other cases not to display Data directory
How it run for the moment:
1)if i only select Section1 or Section2 it install them without displaying the page to select the Appli directory
2)if i select only Data directory, it installs Data Base without displaying the page to select the data directory
3)if i select Section1, Section2 and Section3, it displays Appli directory and Data directory too(it would not display the Data directory in this case).
4)if i select Section1, Section2, Section3 and Section4,it displays Appli directory and Data directory ;(in this case all is right) before installing.
What is wrong in my code specialy in my two functions appliPre and dataPre
Thanks for your help !
Afrow UK
16th May 2005 13:05 UTC
You could try this:
http://nsis.sourceforge.net/archive/...instances=0,64
-Stu
emdiouf
16th May 2005 13:10 UTC
I have read it in the archive and i have adapted it as i explain above but my program don't work as i like.
Can somebody help me or tell what is wrong in my two function pre
Thanks !
Afrow UK
16th May 2005 13:14 UTC
Ok, I see your problem:
You're trying to use SectionGetFlags on the section's title: e.g. SectionGetFlags Section2 $R2
You have to call it on the section's index, e.g. SectionGetFlags ${SEC2} $R2
${SEC2} will contain the section's index number on compile-time.
-Stu
emdiouf
16th May 2005 13:54 UTC
Sorry, i corrected it just after i posted but it don't work, here is a test case of my code but the Pb is the same
In this case i use a macro so that it is more readable,
I think that is about my function pre .
here is the code :
!include "Sections.nsh"
Name Test
OutFile test.exe
Page components
Var ECITIZ_DIR
PageEx directory
DirVar $ECITIZ_DIR
PageCallbacks DirectoryAppliPre "" ""
PageExEnd
Var POSTGRES_DIR
PageEx directory
DirText "Ceci installera la Base de Données PostgreSQL dans le dossier suivant; pour l'installer dans un autre dossier, \
cliquez parcourir et choisissez un autre dossier. Cliquez suivant pour continuer." "Installation de \
la Base de Données PostgreSQL"
DirVar $POSTGRES_DIR
PageCallbacks DirectoryBDPre "" ""
PageExEnd
Page instfiles
!macro SiCocheAlorsVaA TMPVAR SECTION GOTO
SectionGetFlags ${SECTION} ${TMPVAR}
IntOp ${TMPVAR} ${TMPVAR} & ${SF_SELECTED}
IntCmp ${TMPVAR} 1 ${GOTO} +1
!macroend
Function DirectoryAppliPre
Push $1
StrCpy $ECITIZ_DIR "c:\ecitiz"
!insertmacro SiCocheAlorsVaA $1 eCitiz afficherPageAppli
!insertmacro SiCocheAlorsVaA $1 examples afficherPageAppli
Pop $1
Abort
afficherPageAppli:
FunctionEnd
Function DirectoryBDPre
Push $1
StrCpy $ECITIZ_DIR "c:\postgres"
!insertmacro SiCocheAlorsVaA $1 bdd afficherPageDB
Abort
afficherPageDB:
Pop $1
FunctionEnd
SubSection "e-Citiz"
;sous-section d'installation du studio
Section "!e-Citiz Studio" eCitiz
SetOutPath $INSTDIR
MessageBox MB_OK "eCitiz"
SectionEnd
;Sous-section d'installation du bouquet
Section /o "!Exemples de Téléprocédures" examples
SetOutPath $INSTDIR
MessageBox MB_OK "examples"
SectionEnd
Section "!Raccourcis" short
MessageBox MB_OK "short"
SectionEnd
SubSectionEnd
SubSection "Base de données"
# Sous-section d'installation de posgreSQL
Section "!PostgreSQL" bdd
MessageBox MB_OK "bdd"
SectionEnd
SubSectionEnd
SubSection "Adobe Acrobat Reader"
# Sous-section d'installation de Acrobat Reader
Section /o "!Adobe Acrobat Reader" adobe
MessageBox MB_OK "adobe"
SectionEnd
SubSectionEnd
It execute all the instructions of the selected sections(in examples i just displays messages).
But
1°)if i don't select the tree sections eCitiz, examples and short it don't displays the page to select the Appli directory!
2°)if i only select the bdd section it execute the instruction in the bdd section but don't displays the page to select the directory
3°)if i only selected the tree sections eCitiz, examples and short it display the page to select the Appli directory but it displays too the page to select the Data directory even if i don't select the bdd section.
what is wrong with my program ?!
You can test it, it don't work !
Thanks !!!
emdiouf
16th May 2005 16:49 UTC
Hi everybody,
Please don't fotget my post
My code seems to be logic but it don't work as expected
I explain above:
-what i would like to do
-How it works now
Thanks for your reply !