WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

IMAPI

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Using IMAPI2 to Burn CD

 Keywords:   IMAPI IMAPI2  Burn CD IMAPI2.MsftDiscMaster2.1 IMAPI2.MsftDiscRecorder2.1 IMAPI2FS.MsftFileSystemImage.1 IMAPI2.MsftDiscFormat2Data.1 MsftDiscMaster MsftDiscRecorder MsftFileSystemImage MsftDiscFormat2Data

;Winbatch 2007C - Using IMAPI2 to burn CD
;
;This example is for data and assumes all files are
;located in the same folder. Script is adapted from
;VbScript Code. Requires IMAPI v2 installed on PC available from MS
;[ http://www.microsoft.com/downloads/details.aspx?FamilyId=B5F726F1-4ACE-455D-BAD7-ABC4DD2F147B&displaylang=en ]
;
;No error-handler included; Major Caveat: there is also no progress meter
;or messages, you need a recordable CD drive with a blank CD....but it did work
;
;Stan Littlefield, January 29, 2008
;//////////////////////////////////////////////////////////////////////////////////////////////

;Constants
FsiFileSystemISO9660 = 1
FsiFileSystemJoliet  = 2
FsiFileSystemUDF102  = 4
nothing = ObjectType("DISPATCH",0)

Path = "c:\burndir"      ; location of files to transfer to disc

;Create Object and burn CD
oDiscMaster = CreateObject("IMAPI2.MsftDiscMaster2.1")

ForEach ID In oDiscMaster  ;If you know the Drive ID/number, no need for the loop
   oRecorder=CreateObject("IMAPI2.MsftDiscRecorder2.1")
   oRecorder.InitializeDiscRecorder( ID )
Next

oFSI = CreateObject("IMAPI2FS.MsftFileSystemImage.1")
cDir = oFSI.Root

;all Object set, burn it
oDataWriter = CreateObject ("IMAPI2.MsftDiscFormat2Data.1")
oDataWriter.recorder = oRecorder
oDataWriter.ClientName = "IMAPIv2 TEST"
oFSI.ChooseImageDefaults(oRecorder)
cDir.AddTree(Path,@FALSE)
result = oFSI.CreateResultImage()
oStream = result.ImageStream
oDataWriter.write(oStream)

oData=nothing
oFSI=nothing
oRecordset=nothing
oDiscMaster=nothing

Exit
;/////////////////////////////////////////////////////////////////////////////////////////////////////


Article ID:   W18081
Filename:   Using IMAPI2 to Burn CD.txt
File Created: 2010:12:20:12:59:36
Last Updated: 2010:12:20:12:59:36