- NSIS Discussion
- Joining 2 different examples to 1 script
Archive: Joining 2 different examples to 1 script
DBE
12th April 2005 15:17 UTC
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".
DBE
12th April 2005 15:18 UTC
Second attachment
Number 2
Afrow UK
12th April 2005 15:50 UTC
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
DBE
12th April 2005 15:54 UTC
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
14th April 2005 12:32 UTC
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. :mad:
I can't seem to figure out what I'm doing wrong... :confused:
Heeeelp please... :cry:
DBE
14th April 2005 13:28 UTC
In addition, I can attach a printscreen of the error I get.
Afrow UK
14th April 2005 15:18 UTC
It loops because of this:
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
DBE
14th April 2005 15:28 UTC
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
Afrow UK
14th April 2005 16:03 UTC
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
Afrow UK
14th April 2005 16:15 UTC
Updated .onInit function to fix it:
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
DBE
15th April 2005 07:37 UTC
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
18th April 2005 10:09 UTC
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?
Afrow UK
18th April 2005 13:21 UTC
I'll have a look when I get home. There's probably something that I over-looked.
-Stu
Afrow UK
18th April 2005 19:47 UTC
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':
!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
DBE
9th June 2005 10:32 UTC
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?
DBE
9th June 2005 11:21 UTC
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
9th June 2005 11:29 UTC
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?
Afrow UK
9th June 2005 12:12 UTC
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
DBE
9th June 2005 14:31 UTC
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."
Chilli24
9th June 2005 19:34 UTC
Try using AllowRootDirInstall
DBE
10th June 2005 07:35 UTC
Thanks guys,
You've solved my problems!
I really love this community... :)