WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Different 'InstallDir's
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
uweb
Junior Member

Registered: Nov 2002
From:

Different 'InstallDir's

Hi everybody

From my component select dialogue the user can select all items
he wants to install. Than, he clicks on "next" and chooses the
destination folder.
So far, so good.

What I am looking for is the following:
If the user selects "ABC" he than choose the destination folder.
But "ABC" should go into a complete different folder and only in
the case he has selected "ABC" I want to have a *second* dialogue
where he can choose the destination for "ABC".

Is this possible ?
I have version 2.00b (or something very close to this)


Cheers
Uwe

Quick Link | Report this post to a moderator | IP: Logged

uweb is offline Old Post 11-04-2002 03:26 PM
Click Here to See the Profile for uweb Click here to Send uweb a Private Message Click Here to Email uweb Find more posts by uweb Add uweb to your buddy list Edit/Delete Message Reply w/Quote
Jacob Metro
Junior Member

Registered: Nov 2002
From: Alabama, United States of America

SetOutPath

I'm not sure about how to code the logic to do exactly what you want, but a method which will help you is SetOutPath's. Different INSTDIR's will be ignored by the compiler. The first one listed will be the only one to work. SetOutPath's though can be put inside seperate functions.
So, build one function that installs "ABC" one way, and another function to install "BCD" another way. I personally love SetOutPath.

For example,

InstallDir 'C:\WINNT'

Section "-FSIWIN"
SetOutPath $INSTDIR
File /r 'C:\Documents and Settings\Administrator\Desktop\FSIWIN'
SectionEnd

Section "-WHITNEYAPP"
SetOutPath '$INSTDIR\FSIWIN\WHITNEY.APP\'
File 'C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\DESKTOP\WHITNEYAPP\*.*'
CreateShortCut '$DESKTOP\MultiBank.lnk' '$INSTDIR\FSIWIN\WHITNEY.APP\MultiBank.exe'
SectionEnd

This code pulls files from $DESKTOP\FSIWIN and dumps it (recursively) into the WINNT directory. It next pulls data from $DESKTOP\WHITNEYAPP and dumps it into the WINNT\FSIWIN\WHITNEY.APP folder.

You could take out the dashes in front of the Section names and make check boxes from them. Your user then could choose which data he wants to install. And you could choose where you want that data to go.
Again, I'm not really sure how to build the logic necessary to do everything you want, but I think this'll help.
Thanks,
Jacob

__________________
JMETRO

Quick Link | Report this post to a moderator | IP: Logged

Jacob Metro is offline Old Post 11-04-2002 03:49 PM
Click Here to See the Profile for Jacob Metro Click Here to Email Jacob Metro Find more posts by Jacob Metro Add Jacob Metro to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Israel

He wants a second directory selection dialog, not just to output to a specific directory.

What you need is InstallOptions. It allows you to create custom dialog pages. You can make a custom dialog with a directory selection box.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 11-04-2002 03:58 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
Sunjammer
Major Dude

Registered: Jun 2002
From: Swindon, UK

Can you fool NSIS, maybe use .onNextPage and .onPrevPage (yes I know the paging system has changed recently, but in versions which have .onBlah...) to reshow the choose folder dialog (I spose this relies on being able to store the previously chosen instdir into a variable, can that be done?) *or* can the new page system show the folder choice dialog twice?

Sunjammer

Quick Link | Report this post to a moderator | IP: Logged

Sunjammer is offline Old Post 11-04-2002 04:10 PM
Click Here to See the Profile for Sunjammer Click here to Send Sunjammer a Private Message Click Here to Email Sunjammer Visit Sunjammer's homepage! Find more posts by Sunjammer Add Sunjammer to your buddy list Edit/Delete Message Reply w/Quote
uweb
Junior Member

Registered: Nov 2002
From:

Hi,
thanks for your replies

Maybe I was not precise enough, yes, I need a *second* directory
selection dialog.

Thanks for the hint, i will try to figure out how
InstallOptions work -


Uwe

Quick Link | Report this post to a moderator | IP: Logged

uweb is offline Old Post 11-04-2002 04:10 PM
Click Here to See the Profile for uweb Click here to Send uweb a Private Message Click Here to Email uweb Find more posts by uweb Add uweb to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Israel

You can go back to the directory selection page, and you can show the same dialog twice. To change the text of the directory selection dialog you will have to use GetDlgItem and SendMessage. The only problem is it will save the new directory to the same $INSTDIR so you will have to save it in another variable. So, yes, it's another possible solution for this problem

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 11-04-2002 04:19 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
Nils2000
Junior Member

Registered: Mar 2003
From:

HI

these few lines solved the problem for me (NSIS 2 Beta 3, modern UI):

;--------------------------------
!define MUI_CUSTOMPAGECOMMANDS ; i think you need this one
!define MUI_DIRECTORYPAGE
!define MUI_CUSTOMFUNCTION_DIRECTORY_SHOW DirectoryShow
!define MUI_CUSTOMFUNCTION_DIRECTORY_LEAVE DirectoryLeave
;--------------------------------
!insertmacro MUI_PAGECOMMAND_DIRECTORY ; due to MUI_CUSTOMPAGECOMMANDS
!insertmacro MUI_PAGECOMMAND_DIRECTORY ; you can call this one twice, but you need to !insertmacro your other pages too. Since I've got custom pages, it makes no difference for me.
;--------------------------------
; Tweak directory page
Function DirectoryShow
StrCmp $9 "1" ChangeDirectoryPage
StrCpy $9 "1" ; set state for next function entry
Goto EndDirectoryShow

ChangeDirectoryPage:
; change Directory page here for your second directory to query
StrCpy $9 "2" ; last state

EndDirectoryShow:
FunctionEnd
;--------------------------------
Function DirectoryLeave
StrCmp $9 "1" SaveInstallDir
StrCmp $9 "2" RestoreInstallDirAndSaveDatabaseDir
Goto EndDirectoryLeave

SaveInstallDir:
StrCpy $2 $INSTDIR ; store programm directory
Goto EndDirectoryLeave

RestoreInstallDirAndSaveDatabaseDir:
StrCpy $3 $INSTDIR ; store database directory
StrCpy $INSTDIR $2 ; restore programm directory

EndDirectoryLeave:
FunctionEnd
;--------------------------------

In the end you've got your directory in $3 and $INSTALLDIR contains the choosen programm directory.

Any suggestions to optimize this code are appreciated, since I don't really dig this script language.

Quick Link | Report this post to a moderator | IP: Logged

Nils2000 is offline Old Post 03-27-2003 04:28 PM
Click Here to See the Profile for Nils2000 Click here to Send Nils2000 a Private Message Find more posts by Nils2000 Add Nils2000 to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 07:53 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Different 'InstallDir's
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON