Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   How do I prompt for a disc until the user inserts the right one? (http://forums.winamp.com/showthread.php?t=316729)

altie 1st February 2010 23:37

How do I prompt for a disc until the user inserts the right one?
 
I've spent about a week of poking at this, working on other parts of my installer and coming back to it. The EnumCDs, CABSetup and Cdrom plugins all look relevant but I haven't found an example of how to check for a particular disc.

The context for my request: I'm building an installer that grabs a bunch of patches off a network drive, installs some games from disc (Crysis in particular is one I'm working on) and then it applies the patches.

Thanks for your help.

MSG 2nd February 2010 05:47

The CD-ROM plugin isn't going to work - it doesn't support DVDs. I created some functions once that will probably do what you need: http://nsis.sourceforge.net/DVD_functions

I still use it to my satisfaction, maybe it'll do you some good.

altie 2nd February 2010 15:32

I missed your page, looks helpful. I got it working with GetDrives though.

code:

!include FileFunc.nsh
!include LogicLib.nsh
!include nsDialogs.nsh

Function isCrysisDVD
DetailPrint "Checking for Crysis DVD in $9"
${If} ${FileExists} "$9\Crysis.msi"
StrCpy $CrysisInstallerFound True
DetailPrint "Crysis disc found: $9"
ExecWait "msiexec /i $9\Crysis.msi"
StrCpy $0 StopGetDrives
${EndIf}
Push $0
FunctionEnd

Section "Crysis"
CrysisFindDisc:
${GetDrives} "CDROM" "isCrysisDVD"
Pop $0
StrCmp $CrysisInstallerFound True CrysisDone
CrysisRetryCancel:
MessageBox MB_RETRYCANCEL "Please insert a Crysis DVD. If you wish to skip installing Crysis, click cancel." IDRETRY CrysisFindDisc
CrysisDone:
SectionEnd



If you can think of anything I can do to improve this code, let me know. I may refactor it to use your functions later. Either way, a piece of sample code for this task on that page would be very helpful. I'll post it if I end up using your functions.

Afrow UK 2nd February 2010 21:16

Easiest thing to do is to save $EXEDIR somewhere and use the first character of that as the CD/DVD drive for further disks. That is of course assuming the user won't decide to put the next disk in another CD/DVD drive.

Stu

Joel 3rd February 2010 04:43

The idea is to use an ini file with some data, which the installer, when asks for the next CD/DVD, will search and read that data from the ini.

MSG 3rd February 2010 06:38

Joel: Since altie is making a mod/patch/whatever installer for Crysis, modifying the DVD isn't an option.


All times are GMT. The time now is 04:22.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.