Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 12th April 2005, 14:17   #1
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Question Joining 2 different examples to 1 script

Hi all,

After a lot of searching through this forum, and trying out different examples, I finally started developping the Installer I need.

I have 3 DVD's, containing Technical Data, that has to be installed on our engineers laptop. To do this, I used the CopyFiles command.

This works fine, but when swapping from Disc 1 to Disc 2, I get the error Wrong Volume (bla bla bla)....
To solve this, I found a script in these forums. This script works fine, but doesn't have the MUI I like.

Can anyone help me to join these two scripts into one working script that suits my needs?
All help is appreciated...

PS.: I'll attach the two scripts, to get some background information. Setup2.nsi contains the MUI, test.nsi contains "the swapping script".
Attached Files
File Type: nsi setup2.nsi (3.7 KB, 86 views)
DBE is offline   Reply With Quote
Old 12th April 2005, 14:18   #2
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Arrow Second attachment

Number 2
Attached Files
File Type: nsi test.nsi (2.0 KB, 78 views)
DBE is offline   Reply With Quote
Old 12th April 2005, 14:50   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
You need to copy (and modify) the whole .onInit Function from test.nsi to your script.
Then copy the GetNextParm Function too.

That should be enough to make it work.

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 12th April 2005, 14:54   #4
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Okay,

Thanks for the help!

Does it matter where I place the functions?
I mean, do I have to put it in the beginning, or can I just add it at the end of the script?
DBE is offline   Reply With Quote
Old 14th April 2005, 11:32   #5
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Unhappy

Hi all,

I've modified the setup.nsi file as described above, and my installer still doesn't work.
What am I doing wrong? In fact, the installer starts at the first disc, works fine, and then pops a message box that ask me to insert disc two. After doing this (and clicking OK), the message box keeps returning and the script hangs.

I can't seem to figure out what I'm doing wrong...

Heeeelp please...
Attached Files
File Type: nsi setup2.nsi (4.9 KB, 73 views)
DBE is offline   Reply With Quote
Old 14th April 2005, 12:28   #6
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
In addition, I can attach a printscreen of the error I get.
Attached Images
File Type: gif printscreen.gif (18.5 KB, 96 views)
DBE is offline   Reply With Quote
Old 14th April 2005, 14:18   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
It loops because of this:

code:

promptCD:
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "Please insert Disc 2."

IfFileExists "$EXEDIR\DATA\SECT_RIC\RICOH_OLD\CD2.id" secondCD promptCD



"$EXEDIR\DATA\SECT_RIC\RICOH_OLD\CD2.id" obviously does not exist.
What is $EXEDIR at that time (put it in your MessageBox to find out).

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 14th April 2005, 14:28   #8
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Obviously, it goes to the TEMP dir.

And the CD2.id file is on the disc.

How do I direct the script to my CD-ROM drive?
Is there a special variable for this?
I don't want to specify the drive letter in the script, as this may vary from user to user.

Attached: Printscreen $EXEDIR in MB
Attached Images
File Type: gif printscreen2.gif (7.3 KB, 80 views)
DBE is offline   Reply With Quote
Old 14th April 2005, 15:03   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
In .onInit, you can get the CD-Rom drive letter from $EXEDIR like so:
StrCpy $CDDRIVE $EXEDIR 2
; $CDDRIVE will be e.g. E:

Don't forget to declare the $CDDRIVE var with Var CDDRIVE

Edit: No that won't work.

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 14th April 2005, 15:15   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
Updated .onInit function to fix it:

code:

Var CDDRIVE

Function .oninit
IfFileExists "$TEMP\tempCD.tmp" fromHD

CopyFiles "$EXEDIR\setup.exe" "$TEMP"
WriteINIStr "$TEMP\tempCD.tmp" "CD" "Drive" "$EXEDIR"

Exec "'$TEMP\setup.exe'"
Abort

fromHD:
ReadINIStr $CDDRIVE "$TEMP\tempCD.tmp" "CD" "Drive"
Delete "$TEMP\tempCD.tmp"

FunctionEnd



I've used a completely different method here (much simpler).

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 15th April 2005, 06:37   #11
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
So this replaces the whole .onInit function?

Thanks Stu, you da man!!

I'll try it out later on today, and comment it here in this thread.
DBE is offline   Reply With Quote
Old 18th April 2005, 09:09   #12
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Ok, here are my comments on the script.

Everything works fine, except for one small error.

After compiling the script, the .exe file is made.

When executing the file, it doesn't start.

When executing the same file a second time, it works.

Odd...

Can this be fixed?
Attached Files
File Type: nsi setup2.nsi (4.1 KB, 74 views)
DBE is offline   Reply With Quote
Old 18th April 2005, 12:21   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
I'll have a look when I get home. There's probably something that I over-looked.

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 18th April 2005, 18:47   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
I found the problem was with Exec. For some reason I had two lots of quotes on there (probably from the old script when it had parameters with it).

It also fails if you change the OutFile name, so I've added a define which will make things easier incase you decide to change the OutFile to something other than 'setup.exe':
code:

!define OutFile "setup.exe"
!define TempCD "$TEMP\tempCD.tmp"
OutFile "${OutFile}"

Var CDDRIVE

Function .oninit
IfFileExists "${TempCD}" fromHD

CopyFiles "$EXEDIR\${OutFile}" "$TEMP"
WriteINIStr "${TempCD}" "CD" "Drive" "$EXEDIR"

Exec "$TEMP\${OutFile}"
Abort

fromHD:
ReadINIStr $CDDRIVE "${TempCD}" "CD" "Drive"
Delete "${TempCD}"

FunctionEnd



-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 9th June 2005, 09:32   #15
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Hi,

It has been a long time since I've posted here.

I still have an error.
The setup file has to copy itself to the temp-directory, and then copy all the files from the DVD's to the Installation Directory.

The part of the TEMP directory works fine, but everything that comes next, doesn't work.

Can anyone help me out?

Please?
Attached Files
File Type: nsi setup.nsi (4.2 KB, 69 views)
DBE is offline   Reply With Quote
Old 9th June 2005, 10:21   #16
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Quote:
Originally posted by DBE
Hi,

It has been a long time since I've posted here.

I still have an error.
The setup file has to copy itself to the temp-directory, and then copy all the files from the DVD's to the Installation Directory.

The part of the TEMP directory works fine, but everything that comes next, doesn't work.

Can anyone help me out?

Please?
OK, I restarted my test, and found out that the copying to the temp-directory works fine, and the removing of the old data works like a charm.
The Copy Process fails at the first disc. That's where the problems start.
I also discovered that it isn't possible to select the root of the partition (for example D:\). The install button is grayed out when I select this.

Is there a fix for these problems?
DBE is offline   Reply With Quote
Old 9th June 2005, 10:29   #17
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Quote:
Originally posted by DBE
OK, I restarted my test, and found out that the copying to the temp-directory works fine, and the removing of the old data works like a charm.
The Copy Process fails at the first disc. That's where the problems start.
I also discovered that it isn't possible to select the root of the partition (for example D:\). The install button is grayed out when I select this.

Is there a fix for these problems?
My guess is that the script can't find the DATA on the DVD.
Is the $EXEDIR in this script the DVD or the Temp-directory?
DBE is offline   Reply With Quote
Old 9th June 2005, 11:12   #18
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
You need to use $CDDRIVE rather than $EXEDIR. $EXEDIR will indeed be the same as $TEMP (as that is where the installer exe is residing).

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 9th June 2005, 13:31   #19
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Quote:
Originally posted by Afrow UK
You need to use $CDDRIVE rather than $EXEDIR. $EXEDIR will indeed be the same as $TEMP (as that is where the installer exe is residing).

-Stu
Thanks Stu, that's the solution...

If you have a solution for the other problem, please share :-)

I mean this problem

"I also discovered that it isn't possible to select the root of the partition (for example D:\). The install button is grayed out when I select this."
DBE is offline   Reply With Quote
Old 9th June 2005, 18:34   #20
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Try using AllowRootDirInstall
Chilli24 is offline   Reply With Quote
Old 10th June 2005, 06:35   #21
DBE
Junior Member
 
Join Date: Apr 2005
Location: Belgium
Posts: 22
Thanks guys,

You've solved my problems!

I really love this community...
DBE 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