Burning Multisession CDs with IMAPI2 in WSH - Adding files and burning the image
(Page 4 of 5 )
At this point in our script, we have a session image to begin adding files to. This image will contain any existing data on the disc. Next, we'll add any files that we wish to burn, just as we did for single session discs.
WScript.Echo "Adding " & strPath & " directory to the disc..."
objFSI.Root.AddTree strPath, False
The AddTree method is used to add a directory structure and its contents to the existing disc image. The first parameter is a string value indicating a path to a directory containing files to burn. The second parameter is a Boolean value that indicates whether the parent folder should be included in the image or should only add its child objects.
Set objImage = objFSI.CreateResultImage()
Stream = objImage.ImageStream
Once all of the files have been added to the image, the CreateResultImage method is used to create the actual session image. This is similar to saving an ISO image of a CD. You must then create an IStream object to stream that image to the recording device.
objImageWriter.Write(Stream)
Once you have a valid image stream, the write process is started with a single call to the ImageWriter object's Write method. You must provide the data stream to be written as a parameter.
Next: Final thoughts >>
More Windows Scripting Articles
More By Nilpo