Home

Cardbox

 
Cardbox > Support > Knowledge Base ...

Burning CDs from Cardbox

This article uses Cardbox macros. All editions of Cardbox can play macros, but only the Professional Edition can edit or create them.

The easiest way to burn (write) CDs from Cardbox is to use the CD-burning software that is built in to Windows XP. This is fairly limited in its functionality but it does the job. For advice about using Nero to do the same thing, follow this link.

Getting files ready for burning

The help file references and macro features mentioned in this article require Build 4214 (or later) of Cardbox. You can check your build with Help > About Cardbox. If it is older than 4214 then you will need to download a newer version.

The first step is to write the files to the folder that Windows reserves specially for the CD burner. For details of how to automate this process, see the Cardbox help file. Look in the Contents page under "Import and Export".

PictureOnce you have done this, Windows will detect the fact and automatically pop up a message. You can click on the message to start the burning process.

Automating the burning process

You can make your macro open the CD burning wizard. Here is a sample macro that illustrates this.

Dim MyCDRW, CDBurningCommand MyCDRW = WindowsCDBurningDrive Const CDBurningCommand = "Write &these files to CD" InvokeCDWizard Pause "Waiting for the CD to be written" Sub InvokeCDWizard Dim oApp Set oApp = CreateObject("Shell.Application") oApp.Namespace(MyCDRW).Self.InvokeVerbEx CDBurningCommand End Sub

MyCDRW

Windows doesn't provide any straightforward way to discover which drive is actually being used for writing CDs, so Cardbox (from Build 4214 onwards) provides the WindowsCDBurningDrive property instead. If for any reason this doesn't work, you can substitute the name of the CD-writer drive on your own particular computer: for example,

MyCDRW = "F:\"

CDBurningCommand

In order to start the CD burning process, the macro has to send a specific command to Windows - the exact equivalent of right-clicking on the drive name and selecting a menu item from it. Windows doesn't provide any straightforward way to discover the text of that command. In English, the command is "Write these files to CD": the underline is important (you will see it if you pop up the menu by selecting the CD-writer drive and then pressing the Windows menu key) and you will see that it is then represented by an ampersand & in the actual macro. (In Dutch, the command is "De&ze bestanden op CD zetten").

InvokeCDWizard

This subroutine essentially selects the CD-writer drive and invokes the "Write these files to CD" menu command.

Pause

The macro now pauses, to allow the CD writing process to be completed. It will wait until the user clicks on the Continue button in Cardbox.

If this is all the macro is going to do, then the Pause is not strictly necessary; but be aware that you should not close Cardbox until after the CD has been written.

Further automation

You can take this all a step further and get the macro to put in the name to be given to the CD and start the actual burning process. Remove the Pause command from the last macro and add the following:

Const WizardName = "CD Writing Wizard" WaitForWizardToStart StartWizardWriting "PutTitleHere" WaitForWizardToStop Sub WaitForWizardToStart Dim oShell Set oShell = CreateObject("WScript.Shell") Do until oShell.appactivate(WizardName) Sleep 500 Loop End Sub Sub StartWizardWriting(name) Dim oShell Set oShell = CreateObject("WScript.Shell") oShell.appactivate(WizardName) oShell.SendKeys name oShell.appactivate(WizardName) oShell.SendKeys "{Enter}" End Sub Sub WaitForWizardToStop Dim oShell Set oShell = CreateObject("WScript.Shell") 'Create As Object Do until Not oShell.appactivate("CD Writing Wizard") ' Keep script running until Dialog is gone, ' or else the wizard will close. sleep 500 Loop End Sub

Const WizardName

Windows doesn't provide any straightforward way to discover the name that will be given to the CD writing wizard once it is launched. In English, it is "CD Writing Wizard". This name is needed because the macro needs to communicate with the CD Writing Wizard window by name.

WaitForWizardToStart

Having sent the command to start the wizard, the macro needs to wait for the wizard to start. It does this by repeatedly attempting to activate the wizard's window: when it succeeds, it knows that the wizard is alive.

StartWizardWriting

Now that the wizard has started, the macro does exactly what you would do: it types the chosen name of the CD into the relevant box in the CD writing wizard, and then presses Enter to go to the next screen and start the writing process.

WaitForWizardToStop

Strictly speaking, there is no need for the macro to wait for the CD writing wizard to stop, but our experiments indicate that it is safer to wait, because if you close Cardbox while the wizard is writing then this can cause problems for the writing process.

© 2008 Cardbox Software Limited
"Cardbox" is a registered trademark of Cardbox Software Limited
 Top of page