- NSIS Discussion
- CD-ROM drive readiness
Archive: CD-ROM drive readiness
ewallig
24th May 2006 19:00 UTC
CD-ROM drive readiness
Hi all,
Not trying to dig up older threads on multi-disk installations - think i've got that figured out. My question: is there a way to check the readiness of a drive (CD-ROM, for example)?
My problem is that if the user installing my multi-disk set has a slow CD-ROM and clicks "OK" for the next CD before the disk has spun up, errors are occurring. I'd like to write into the installer a check to see if the drive is ready to be read.
Any ideas? Thanks...
Red Wine
24th May 2006 19:07 UTC
Try this plugin http://nsis.sourceforge.net/CDRom_plug-in
ewallig
24th May 2006 20:42 UTC
That will probably do it...uh...hmm...guess I'm still a bit of an amateur :(
- How would you write a conditional that would loop until the value of cdrom::status was 1?
Thanks..
Red Wine
24th May 2006 20:48 UTC
@example
_loop:
StrCmp $0 '1' 0 _loop
ewallig
24th May 2006 21:17 UTC
Thanks - still having some issues - tried this:
#spin until the CD is ready
_loop:
cdrom::status "" .R0
StrCmp $R0 '1' 0 _loop
It still jumps ahead sometimes - the next line of code invokes 7zip which fails because it can't find the archive on the CD-ROM.
Any ideas?
Thanks again..
Red Wine
24th May 2006 21:24 UTC
Your code looks OK, though .R0?
I have not ever used the plugin, I guess Instructor should provide the correct use. Probably an issue because of the relative jump? Try to replace 0 with a label or better use LogicLib :-)
Instructor
24th May 2006 22:59 UTC
_loop:
cdrom::status "" .R0
StrCmp $R0 '1' _ready
MessageBox MB_OKCANCEL 'Insert CD-ROM disk and press OK' IDOK _loop IDCANCEL _exit
_ready:
_exit:
ewallig
25th May 2006 14:20 UTC
Thanks - that fixed the code problem but ultimately did not fix the problem that I was having. The CD-ROM is now reporting that it is ready but (intermittantly) 7zip can't find the archive on the disk so it pops an error code.
Any thoughts on how I could capture that error message and use it to retry the command?
Thanks again...
shaunb
25th May 2006 14:23 UTC
can't you copy the archive off the disc into $TEMP ?
ewallig
25th May 2006 14:29 UTC
Yeah, I did that at first but it takes twice as long for the installation - the archive is 400+MB of compressed pdf data; if i first copy it to TEMP it takes about 4 minutes to do the copy. Extraction takes another 4-6 mintures, depending on computer so now I've got 10 minutes install time per disk; I've got 3 disks to complete the installation.
Thanks anyway though :)
shaunb
25th May 2006 14:36 UTC
maybe plain pdf files in no compressed archive would be faster, and just manually copying them using "File" or something.
at least its lots of smaller files then *shrug*
ewallig
25th May 2006 15:02 UTC
Yeah, tried that too - not the results that I wanted. However, I think that I've resolved the current problem that I'm having by adding a 5 second pause after the CD-ROM reports that it's ready - we'll see....
Thanks again..
Afrow UK
25th May 2006 15:26 UTC
Put an empty file on your disk and use this code to check if it is readable:
StrCpy $R0 0
TryAgain:
Sleep 1000
ClearErrors
FileOpen $R1 "$EXEDIR\setup.tmp" r
IfErrors 0 Done
IntOp $R0 $R0 + 1
StrCmp $R0 10 0 TryAgain
MessageBox MB_OK|MB_ICONSTOP \
"No CD detected etc..."
Abort
Done:
FileClose $R1
-Stu
ewallig
25th May 2006 15:42 UTC
Thanks Stu, I'll give that a try as soon as I can :)
- Ed