Burning CDs from Cardbox using Nero
Nero is a respected and widely used program for burning CDs and DVDs. It has far more features and options than the built-in CD-burning facilities in Windows, and for this reason many people use it instead.
This article is a re-working of the article in the Cardbox help file that describes burning CDs from within Cardbox: to read that article, look at "Import and Export" in the Contents page of the help.
What you need before you start
First of all, you need Nero Burning ROM. This is commercial software and it can be bought directly from http://www.nero.com.
You need a utility program called nerocmd.exe. This is installed as part of Nero Burning ROM.
You will also need the documentation for nerocmd.exe. You can get summary documentation by opening a command window in Windows, and typing the following commands:
cd "C:\Program Files\Ahead\Nero" nerocmd
(this assumes that Nero has been installed in its default location).
For serious work, you should download and print out the 24-page "NeroCmd User's Manual". This is available as part of the Nero Software Development Kit: to find this, search for "SDK" using the search function in the main Nero web page.
A warning
Nero is a rich and complex tool with many options. When you use the normal Windows interface it guides you through the options you should choose, but you don't have this assistance when you use nerocmd.exe. Be aware that you need to think a bit more carefully, and make sure that your CDs are readable, and contain what you want, by doing a few test runs. There is nothing worse than having a crash and discovering that your past six months' backups contain the wrong data or no data at all!
Getting files ready for burning
The most straightforward way of using Nero is this:
- Choose a folder that will contain all the files that are intended to be written to the CD.
- Empty that folder.
- Write or copy files to that folder.
- Use Nero to write the files from that folder to the CD.
Example
This sample macro downloads all database and format files that it currently has open on a Cardbox server, and then copies the downloaded files to the temporary folder.
Const DOWNLOADFOLDER="C:\MyBackups" Const NEROFOLDER="C:\NeroTemp" Const CDNAME="Nero" Const NEROCMD="C:\Program Files\Ahead\Nero\nerocmd.exe" Const CDDRIVE="f" For Each db In Databases DownloadOneDatabase db Next CopyFilesToCDFolder DOWNLOADFOLDER BurnFilesToCD Sub DownloadOneDatabase(db) filename=db.FullName ' For example, cardbox://servername/databasename If Left(filename,10)<>"cardbox://" Then Exit Sub ' Do not do anything about local databases. posName=InstrRev(filename,"/") ' posName shows where the server name ends and the filename starts. fname=DOWNLOADFOLDER & "\" & Mid(filename,posName+1) ' for example, C:\MyBackups\databasename StatusText=Mid(filename,posName+1) & ".FIL" ' for example, C:\MyBackups\databasename.FIL db.Download fname & ".FIL",cbxDownloadFIL StatusText=Mid(filename,posName+1) & ".FMT" db.Download fname & ".FMT",cbxDownloadFMT+cbxDownloadDatabaseMacros+cbxDownloadRelatedMacros End Sub Sub CopyFilesToCDFolder(fromFolder) Set fso=CreateObject("Scripting.FileSystemObject") fso.DeleteFile NEROFOLDER & "\*.*" ' delete any files within the Nero folder. fso.DeleteFolder NEROFOLDER & "\*.*" ' delete any folders within the Nero folder. fso.CopyFile fromFolder & "\*.*",NEROFOLDER ' Copy files from the download folder. fso.CopyFolder fromFolder & "\*.*",NEROFOLDER ' Copy folders (eg. macros) from the download folder. End Sub Sub BurnFilesToCD cmd="--write" cmd=cmd & " --drivename " & CDDRIVE cmd=cmd & " --real" ' really write, don't just simulate cmd=cmd & " --verify" ' verify after writing cmd=cmd & " --detect_non_empty_disc" ' if the disc has data, offer to overwrite or erase cmd=cmd & " --iso " & CDNAME cmd=cmd & " --recursive" ' look inside subfolders of NEROFOLDER cmd=cmd & " """ & NEROFOLDER & "\*.*""" ' Put quotes round the filename in case the folder name has spaces x=Run(NEROCMD,cmd) ' Burn the CD If x<>0 Then Halt "Nero reported an error: the return code was " & x End Sub
DOWNLOADFOLDER
Set this to the name of a folder that you intend to use for the downloaded files.
NEROFOLDER
Set this to the name of the folder that you intend to use for files that are ready to be written to the CD. This macro does not create this folder automatically, so you should do it yourself; and it erases all files in the folder before copying new files into it.
CDNAME
Every CD written by your computer has a name, which can be up to 11 characters long. Choose whatever name you like.
NEROCMD
The macro has no way of knowing where nerocmd.exe is, so you have to tell it. The location we have given is the commonest one, but you should check your own system to make sure.
CDDRIVE
Set this to a single letter, indicating the drive letter of the CD writer on your computer.
For ... Next
This loop iterates through every database that is currently open in Cardbox.
DownloadOneDatabase
This subroutine downloads the database file, format file, and macros for a database.
CopyFilesToCDFolder
This subroutine copies all the downloaded files to the folder you have chosen for Nero. It also copies all folders from the download folder, because if there were any macros attached to the databases you were downloading then they will have been stored in folders within the download folder.
BurnFilesToCD
This subroutine creates a command line containing all the commands and options needed to burn the CDROM, and runs nerocmd.exe to perform the actual burning. The macro then pauses until burning has completed (or failed) and checks the exit code reported by Nero. If the exit code is non-zero then this indicates an error: the NeroCmd User's Manual lists possible exit codes and their meanings.
Notes about the sample macro
We could have made the macro simpler by telling it to download files directly to the NEROFOLDER folder instead of downloading them first and then copying them. But Cardbox's Download process operates far faster if it is downloading onto a previously downloaded copy of the same file. By having a separate download folder we can take advantage of this speed increase, whereas if we were to download directly to the NEROFOLDER folder (which is emptied each time the macro is run) then the downloads would be much slower.
On the other hand, it would be possible to streamline the process described here by burning directly from the DOWNLOADFOLDER folder. In this case CopyFilesToCDFolder would not be needed at all.
Further information
In addition to the information given in the Nero SDK itself, there is a support forum in which you can ask questions and have them answered by other users of Nero. There is a link to the support forum in the middle of the Nero SDK page.
Nero pages
(These links are outside our control. They were checked on 17 November 2005 but they may change at any time).