Old 24th May 2006, 18:00   #1
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
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...
ewallig is offline   Reply With Quote
Old 24th May 2006, 18:07   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Try this plugin http://nsis.sourceforge.net/CDRom_plug-in

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 24th May 2006, 19:42   #3
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
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..
ewallig is offline   Reply With Quote
Old 24th May 2006, 19:48   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
@example
_loop:
StrCmp $0 '1' 0 _loop

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 24th May 2006, 20:17   #5
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
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..
ewallig is offline   Reply With Quote
Old 24th May 2006, 20:24   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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 :-)

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 24th May 2006, 21:59   #7
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
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:

Instructor is offline   Reply With Quote
Old 25th May 2006, 13:20   #8
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
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...
ewallig is offline   Reply With Quote
Old 25th May 2006, 13:23   #9
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
can't you copy the archive off the disc into $TEMP ?
shaunb is offline   Reply With Quote
Old 25th May 2006, 13:29   #10
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
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
ewallig is offline   Reply With Quote
Old 25th May 2006, 13:36   #11
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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*
shaunb is offline   Reply With Quote
Old 25th May 2006, 14:02   #12
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
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..
ewallig is offline   Reply With Quote
Old 25th May 2006, 14:26   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 14:42   #14
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
Thanks Stu, I'll give that a try as soon as I can


- Ed
ewallig is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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