Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 8th July 2009, 07:44   #1
xma
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
xma is offline   Reply With Quote
Old 8th July 2009, 13:12   #2
jpderuiter
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.
jpderuiter is offline   Reply With Quote
Old 8th July 2009, 16:57   #3
xma
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
xma is offline   Reply With Quote
Old 8th July 2009, 21:14   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 8th July 2009, 21:24   #5
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
OK, if you just need a second directory page, you can do three things:
  1. Use two Directory pages: (http://nsis.sourceforge.net/Two_inst..._one_installer)
  2. Add a textbox and a browse button with resource hacker, add a callbackfunction for the browse button, and call the DialogsEx plug-in (http://nsis.sourceforge.net/Dialog****plug-in) in this callback to show a folder browse dialog box.
  3. Don't use the standard Directory page, and create your own custom page with two nsDialogs DirRequest controls.
JP
jpderuiter is offline   Reply With Quote
Old 8th July 2009, 21:40   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 9th July 2009, 08:55   #7
xma
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.
xma is offline   Reply With Quote
Old 9th July 2009, 10:59   #8
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
With the callback function I meant using the ButtonEvent Plugin I mentioned before.
jpderuiter is offline   Reply With Quote
Old 9th July 2009, 11:42   #9
xma
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
xma is offline   Reply With Quote
Old 9th July 2009, 11:55   #10
MSG
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"
MSG is online now   Reply With Quote
Old 9th July 2009, 11:56   #11
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
You can set the root of a DirRequest in an InstallOptions ini file with
code:
!insertmacro MUI_INSTALLOPTIONS_WRITE "CustomDialog.ini" "Field 1" "Root" "c:\Program Files\xyz"
(Note the MUI_INSTALLOPTIONS_WRITE instead of MUI_INSTALLATIONS_WRITE).

However, I recommend using nsDialogs instead of InstallOptions .
jpderuiter is offline   Reply With Quote
Old 9th July 2009, 12:51   #12
xma
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
xma is offline   Reply With Quote
Old 9th July 2009, 14:28   #13
xma
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
xma is offline   Reply With Quote
Old 9th July 2009, 15:49   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 9th July 2009, 16:30   #15
xma
Junior Member
 
Join Date: Jul 2009
Posts: 15
Exactly I was writing the wrong file... Hard day...
Thank you
xma is offline   Reply With Quote
Old 9th July 2009, 16:54   #16
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
And you should set the "State" field to $INSTDIR instead of the "Text" field.
jpderuiter is offline   Reply With Quote
Old 10th July 2009, 08:50   #17
xma
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 ?
xma is offline   Reply With Quote
Old 10th July 2009, 09:25   #18
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 10th July 2009, 09:37   #19
xma
Junior Member
 
Join Date: Jul 2009
Posts: 15
Thanks
Exactly what i tried and it works now !!
xma is offline   Reply With Quote
Old 13th July 2009, 09:42   #20
xma
Junior Member
 
Join Date: Jul 2009
Posts: 15
I really want to thank you for your help !
I put this discussion to resolve
xma is offline   Reply With Quote
Old 13th July 2009, 09:44   #21
xma
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]
xma is offline   Reply With Quote
Reply
Go Back   Winamp 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