Old 7th November 2012, 12:28   #1
devcphp
Junior Member
 
Join Date: Nov 2012
Posts: 3
Probleme recuperate var in custom pages

Hi

I want to recuperate some var in a custom pages but i can't realise it.

code:
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY

Page custom ShowCustomPageConfigurationMatricesServeur LeaveCustomPageConfigurationMatricesServeur

Function ShowCustomPageConfigurationMatricesServeur
ReserveFile "${PAGE_CUSTOM_MATRICES_SERVEUR}"
!insertmacro MUI_HEADER_TEXT "Personnalisation" ""
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "${PAGE_CUSTOM_MATRICES_SERVEUR}"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "${PAGE_CUSTOM_MATRICES_SERVEUR}"
FunctionEnd
Function LeaveCustomPageConfigurationMatricesServeur
ReadINIStr $R0 "${PAGE_CUSTOM_MATRICES_SERVEUR}" "Field 1" "State"


ReadINIStr $R1 "${PAGE_CUSTOM_MATRICES_SERVEUR}" "Field 2" "State"
ReadINIStr $R2 "${PAGE_CUSTOM_MATRICES_SERVEUR}" "Field 3" "State"
ReadINIStr $R4 "${PAGE_CUSTOM_MATRICES_SERVEUR}" "Field 4" "State"
ReadINIStr $R5 "${PAGE_CUSTOM_MATRICES_SERVEUR}" "Field 9" "State"
ReadINIStr $R6 "${PAGE_CUSTOM_MATRICES_SERVEUR}" "Field 12" "State"

FileOpen $0 ${NOM_FICHIER_PARAMETRAGE_XML} w
FileWrite $0 "<?xml version=$\"1.0$\" encoding=$\"ISO-8859-1$\" standalone=$\"no$\"?$\r$\n"
FileWrite $0 "<!-- standalone=no pour faire savoir à l'analyseur syntaxique xml que la dtd se trouve dans un fichier séparé-->$\r$\n"

FileWrite $0 "<!DOCTYPE ParametrageGeneral SYSTEM $\"Parametrage.dtd$\">$\r$\n"
FileWrite $0 "<ParametrageGeneral>$\r$\n$\t"
FileWrite $0 "<!--Configuration des éléments nécéssaires aux types de connexions aux bases de données-->$\r$\n$\t"
FileWrite $0 "<TypeConnexions>$\r$\n$\t"
FileWrite $0 "<ParamTypeConnexion id=$\"CONNECTION_TO_ACCESS$\">odbcriver={Microsoft Access Driver (*.mdb)};Dbq=</ParamTypeConnexion>$\r$\n$\t"
FileWrite $0 "</TypeConnexions>$\r$\n"
FileWrite $0 "<Connexions>$\r$\n$\t"
FileWrite $0 "<ParamConnexion id=$\"CONNECTION_TO_ACCESS_ANALYSIMMO$\">$R0</ParamConnexion>$\r$\n$\t"
FileWrite $0 "<ParamConnexion id=$\"CONNECTION_TO_MYDB$\">$R2</ParamConnexion>$\r$\n$\t"
FileWrite $0 "<ParamConnexion id=$\"CONNECTION_TO_ACCESS_DPE$\">$R1</ParamConnexion>$\r$\n$\t"
FileWrite $0 "<ParamConnexion id=$\"CONNECTION_TO_CADASTRE$\">http://www.cadastre.gouv.fr</ParamConnexion>$\r$\n"
FileWrite $0 "</Connexions>$\r$\n"
FileWrite $0 "<!--Configuration des éléments nécéssaires aux documents-->$\r$\n"
FileWrite $0 "<Generations>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"SCRIPT_VB_TO_PDF$\">$INSTDIR\${PDFCREATOR_DATA_FICHIERS_SOURCES}\Convert2Pdf.vbs</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"SCRIPT_VB_TO_PNG$\">$INSTDIR\${PDFCREATOR_DATA_FICHIERS_SOURCES}\Convert2Png.vbs</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"SCRIPT_VB_TO_TIFF$\">$INSTDIR\${PDFCREATOR_DATA_FICHIERS_SOURCES}\Convert2Tiff.vbs</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"SCRIPT_VB_TO_BMP$\">$INSTDIR\${PDFCREATOR_DATA_FICHIERS_SOURCES}\Convert2Bmp.vbs</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"SCRIPT_VB_TO_JPG$\">$INSTDIR\${PDFCREATOR_DATA_FICHIERS_SOURCES}\Convert2Jpg.vbs</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"CHEMIN_DE_GENERATION$\">$R6</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"MATRICE_ERNT$\">$R2</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"MATRICE_NON_INDEMNISATION$\">$R4</ParamGeneration>$\r$\n$\t"
FileWrite $0 "<ParamGeneration id=$\"MATRICE_INDEMNISATION$\">$R5</ParamGeneration>$\r$\n"
FileWrite $0 "<Versions>$\r$\n$\t"
FileWrite $0 " <ParamVersion id=$\"VERSION_FICHIER_XML_PARAMETRAGE$\">2.0.3</ParamVersion>$\r$\n$\t"
FileWrite $0 "<!--<ParamVersion id=$\"VERSION_LOGICIEL$\">2.0.0</ParamVersion>-->$\r$\n$\t"
FileWrite $0 "<ParamVersion id=$\"VERSION_SERVEUR_ERNT$\">3.0.0</ParamVersion>$\r$\n"
FileWrite $0 "</Versions>$\r$\n"
FileClose $0
FunctionEnd



i write an xml file but whitout any var.

But if i write manually the state in the .ini file, the xml file output contain the variable.

Where is my error?
devcphp is offline   Reply With Quote
Old 7th November 2012, 13:31   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
(Please use pastebin or an attachment to share large amounts of code.)

First of all, verify that $R0-6 contains the proper value, using a MessageBox. If the variable is empty, it cannot be written to a file either.
Second, your code example is rather unclear. Please provide a minimal script that shows your problem (without ${defines} that we don't know, etc...), and explain what it should do and what it actually does.
MSG is offline   Reply With Quote
Old 7th November 2012, 14:03   #3
devcphp
Junior Member
 
Join Date: Nov 2012
Posts: 3
thank's for your response.
When i use a sgBox, i don't have any value of my var.

i will modify my code as you like
devcphp is offline   Reply With Quote
Old 7th November 2012, 15:35   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
If the Msgbox is empty, it means either the state is not set, or the ini file is not being read properly. Since manually editing the ini works, we must conclude that the state is not set.

Not sure how that's happening, it's been years since I've touched InstallOptions. Perhaps someone else can help you, but that's where the problem appears to begin, at least.
MSG is offline   Reply With Quote
Old 8th November 2012, 13:18   #5
devcphp
Junior Member
 
Join Date: Nov 2012
Posts: 3
effectively the state is not set. If i set it manuelly by editing the ini file no problem. if not nothing is read.
devcphp 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