|
|
|
|
#1 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
Custom pages and registry settings
I have a custom page that I made and i would like whatever is put in the TEXT fields to be saved to the registry in windows.
Thx for any help you can provide. code: |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
In the page's Leave function, use ReadINIStr to retrieve the Text string, and then write it to the registry using WriteRegStr.
-Stu |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
sry, don't know where the documentation for that is, can you put it in one fo the example scripts so that I can figure out where it goes, Thx alot
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
ReadINIStr and WriteINIStr are in the NSIS documentation.
For example: code: -Stu |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
It is creating the registry entryis now but it isn't putting anything in them. Thx for the help but I must be missing something.
code: Same INI as above |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
You are reading from INI file into $R0, but writing variable $R1 to registry.
-Stu |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
OK, Thx but still there is nothing in the data field of the registry key
code: code: |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
This code needs to go in the page's Leave function:
code: User input from the InstallOptions dialog are not saved to the INI file until after the user leaves the page. That's why you aren't getting any data. Declare the Leave function like so: Page Custom customPageA customPageALeave -Stu |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
can you show me what it should look like, please? Thx
|
|
|
|
|
|
#10 |
|
Guest
Posts: n/a
|
Custom pages and registry
hello Installers,
I have the same problem that you are faceing . this is a small piece of script Function SetContentServer Push $R0 InstallOptions::dialog $PLUGINSDIR\ContentServer_Name.ini Pop $R0 ReadINIStr $1 "$PLUGINSDIR\ContentServer_Name.ini" "Field 2" "Text" FunctionEnd Function SetContentServerLeave ; Push $1 WriteRegStr HKLM "Software\Legato\ContentServer" "ServerName" "$1" FunctionEnd If i put the text from the Page properties before compilation it writes into the registry. but If i take it from the user at runtime it does not. Wht could be the issue? why does "Var varname" variable decleration not work ? Your help will be appreciated. Regards Parag |
|
|
|
#11 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
The leave function is called when the user clicks the next button, before the InstallOptions::dialog call returns. Simply write the value to the registry right after you read it in SetContentServer.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#12 |
|
Member
Join Date: Nov 2001
Location: Seattle, Washington
Posts: 78
|
While not vastly experienced in custom pages, I do have *one* and use a slightly different model...
![]() I use an .onInit to check the registry for an existing value for my field - if it is present, I directly update the corresponding field in the [now expanded] INI file. BTW, since it makes sense for my case, I use the install options length-validating feature to enforce the length restrictions for my data entry field. This blocks the user from proceeding past that page until the restrictions are satisfied. Then, in the body of the installer section - actually, just before it completes - I do a MUI_INSTALLOPTIONS_READ to get the value of the field, and save it to the registry with a WriteRegStr. I am posting this both to make sure that my approach is sound (it does seem to work), and to mention that using the Leave function can have the side-effect of making a registry change (in the case described above) even if the user chooses to back out of (abort) the install... |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
this is all wonderful info and I hope to put it in my next installer, however, where should I place "Page Custom customPageA customPageALeave ", Thx
|
|
|
|
|
|
#14 |
|
Member
Join Date: Nov 2001
Location: Seattle, Washington
Posts: 78
|
The "page custom..." would go in the midst of your "!insertmacro MUI_PAGE*" statements.
It is just saying that you have a custom page and that it has both Enter and Leave functions defined. The precise placement determines where in the sequence of pages making up your installer it appears. |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
tried it and got this error and it won't create any .exe now
code: Any Ideas? Thx |
|
|
|
|
|
#16 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
It means you haven't declared the customPageALeave Function
![]() You need to do it like: Function customPageALeave # ... code here ... FunctionEnd -Stu |
|
|
|
|
|
#17 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
ok it actually made the Installer but now it still isn't writing the registry keys. See included zip with all the code and .ini's, thx for any help you can provide
|
|
|
|
|
|
#18 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Put "MessageBox MB_OK $R0" under the first ReadINIStr in your Leave function to see what the value of $R0 is.
Also you don't need the Pop and Push in the middle. -Stu |
|
|
|
|
|
#19 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
it isn't capturing the text put in the boxes, nothing is diplayed in the popup
|
|
|
|
|
|
#20 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Oh wait, if you're reading from a Text field, then you ReadINIStr from "State" not "Text"
-Stu |
|
|
|
|
|
#21 |
|
Junior Member
Join Date: Mar 2005
Posts: 16
|
OK, thx now it works, thx for your patience, it is my first project
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|