From: Heinz on
Hello,

I have found some VBS code that uses IMAPI2 to write data on CD/DVD.

This works well, but I would need to add additional functionality such as :

-write speed (for example : determine max. possible speed, set write speed)
-error checking (for example : detect "no disk inserted"...)
-device and media compatibility

How could I add such things ?
All what I have found so far are links to
http://msdn.microsoft.com/en-us/library/aa366224.aspx
but there is no sample code for VBS (at least, I haven't found some)

Here is the code that I have:
(http://www.aspfree.com/c/a/Windows-Scripting/Burning-CDs-with-the-IMAPI2-Control)

intIndex = 0
strPath = "C:\BurnTemp"
Set objDiscMaster = WScript.CreateObject("IMAPI2.MsftDiscMaster2")


Set objRecorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2")
strDevice = objDiscMaster.Item(intIndex)
objRecorder.InitializeDiscRecorder(strDevice)



Set objImageWriter = CreateObject("IMAPI2.MsftDiscFormat2Data")
objImageWriter.Recorder = objRecorder
objImageWriter.ClientName = "IMAPI Script"


Set objFSI = CreateObject("IMAPI2FS.MsftFileSystemImage")
objFSI.ChooseImageDefaults(objRecorder)


objFSI.FileSystemsToCreate = 1


Set objDir = objFSI.Root
objDir.AddTree strPath, False


Set objImage = objFSI.CreateResultImage()
Stream = objImage.ImageStream

wscript.echo "start writing:"

'control will not return to the script until the burn process has completed.
objImageWriter.Write(Stream)



thank you
Heinz







 | 
Pages: 1
Prev: Filtering ADO query
Next: replace files in list