|
|
#1 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
INI file
Hi evryone,
I am trying to add components to the page directory of the installer. I use ressource hacker to add groupbox, bouton, etc.. Now those components are visible when i launch this installer but i can t use them in my code to specify their use. For exemple, I would like my button to be a dirRequest. I think I have to declare them in a file .ini but I don't know where I can get the ini file for the default installation pages in order to add field for the components If someone can help me it will be greatfull Thank you |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Feb 2007
Posts: 545
|
You have to use the ButtonEvent Plugin: http://nsis.sourceforge.net/ButtonEvent_plug-in
Read the readme in the zip for more info. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
Thanks for your reply
![]() I was reading doc of ButtonEvent. I don't think i can't make this button become a DirRerquest like the one which is already exist in the directory page. I am newbie and maybe I am not doing the right thing to obtain what i want. I just need to add another directory request in the default MUI_PAGE_DIRECTORY. Do you have any ideas to do that because i am looking evrywhere and i can't get a solution to my problem ? Thank you |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Easier just to add another MUI_PAGE_DIRECTORY.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Feb 2007
Posts: 545
|
OK, if you just need a second directory page, you can do three things:
|
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
That example with two directory pages is probably more than you need as it also has two components and instfiles pages. To have two directory pages you just need to specify a different variable to use for the second using !define MUI_DIRECTORYPAGE_VARIABLE INSTDIR2 (say).
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
Thanks for your reply i really appreciate
![]() I know that we can add another MUI_PAGE_DIRECTORY but really want to put the two DirRequest in the same page. So i might use the second solution of JP but I am not familiar to callback function and plugin. If i use this plugin does the path of the folder will appear in the textbox? will INSTDIR2 be automatically the variable for the second DirRequest ? I'm going to have a look of the plugin and try to use it. |
|
|
|
|
|
#8 |
|
Major Dude
Join Date: Feb 2007
Posts: 545
|
With the callback function I meant using the ButtonEvent Plugin I mentioned before.
|
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
Ok, as I'm not very familiar with plugin i decide to create my own custom directory page to replace the default MUI_DIRECTORY_PAGE.
Now I would like to know how can I insert a default path to each DirRequest (Like $InstDIR before) I tried with MUI_INSTALLATIONS_WRITE but it doesn't seem to work. Do you have any idea ? Thank you |
|
|
|
|
|
#10 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,839
|
Assuming you're using nsDialogs to create your custom page: You can set the default path in the dir request creation macro, like this:
${NSD_CreateDirRequest} 10u 85u 210u 12u "YOUR DEFAULT GOES HERE" |
|
|
|
|
|
#11 |
|
Major Dude
Join Date: Feb 2007
Posts: 545
|
You can set the root of a DirRequest in an InstallOptions ini file with
(Note the MUI_INSTALLOPTIONS_WRITE instead of MUI_INSTALLATIONS_WRITE).code: However, I recommend using nsDialogs instead of InstallOptions . |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
I am using IstallOptions... Sorry
I have tried to put a Root parameter but i still can't see the path in the TextBox ! However I would like to put a variable instad of "C:\...\" like INSTDIR for exemple. I need to switch the both default path if the user is admin or not. Thanks again for your help
|
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
If I have understand,
MUI_INSTALLOPTIONS_WRITE allow to write dynamicly in the ini file : !insertmacro MUI_INSTALLOPTIONS_WRITE "NewDirectoryPage.ini" "Field 2" "Text" "$INSTDIR" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NewDirectoryPage" So after this instruction the textbox of the DirRequest should show my INSTDIR value... but it doesn't happen. Do you have any explaination ? I extract the ini file in my function .oninit |
|
|
|
|
|
#14 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
You have some inconsistencies here. Are you extracting as NewDirectoryPage.ini or NewDirectoryPage? You are writing to NewDirectoryPage.ini but showing NewDirectoryPage.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
Exactly I was writing the wrong file... Hard day...
Thank you |
|
|
|
|
|
#16 |
|
Major Dude
Join Date: Feb 2007
Posts: 545
|
And you should set the "State" field to $INSTDIR instead of the "Text" field.
|
|
|
|
|
|
#17 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
Thanks JP i changed that.
So now in my DirRequest textbox i have $PROGRAMFILES or $APPDATA depending on the user status. But the user can still change the directory and i can't get dynamicly the path he entered. I would like his choice become the $INSTDIR variable. I tried with this : !insertmacro MUI_INSTALLOPTIONS_READ $INSTDIR "NewDirectoryPage" "Field 2" "State" but that doesn't change anything. Is there a way to do this ? |
|
|
|
|
|
#18 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
That will work if done from the leave function. If that is what you are doing then post some code. You can also put in some message boxes to pause the installer then you can look in %TEMP%\ns???.tmp\* to find your INI file.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#19 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
Thanks
Exactly what i tried and it works now !! |
|
|
|
|
|
#20 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
I really want to thank you for your help
!I put this discussion to resolve |
|
|
|
|
|
#21 |
|
Junior Member
Join Date: Jul 2009
Posts: 15
|
[RESOLVE]Originally posted by xma
I really want to thank you for your help !I put this discussion to resolve [/QUOTE] |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|