Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   CD-ROM drive readiness (http://forums.winamp.com/showthread.php?t=246931)

ewallig 24th May 2006 18:00

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 18:07

Try this plugin http://nsis.sourceforge.net/CDRom_plug-in

ewallig 24th May 2006 19:42

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 19:48

@example
_loop:
StrCmp $0 '1' 0 _loop

ewallig 24th May 2006 20:17

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 20:24

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 21:59

code:
_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 13:20

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 13:23

can't you copy the archive off the disc into $TEMP ?

ewallig 25th May 2006 13:29

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 13:36

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 14:02

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 14:26

Put an empty file on your disk and use this code to check if it is readable:

code:
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 14:42

Thanks Stu, I'll give that a try as soon as I can :)


- Ed


All times are GMT. The time now is 17:51.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.