Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - Burning Multisession CDs with IMAPI2 in WS...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Burning Multisession CDs with IMAPI2 in WSH
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-11-10

    Table of Contents:
  • Burning Multisession CDs with IMAPI2 in WSH
  • Getting started
  • Building the burn image
  • Adding files and burning the image
  • Final thoughts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Burning Multisession CDs with IMAPI2 in WSH - Getting started


    (Page 2 of 5 )

    The process for burning multisession discs with IMAPI2 is virtually identical to that of burning single session discs.  We'll first set up the recording device, then prepare a data image, and finally, write that image to disc.  The process differs in how we create the disc image.

    intIndex = 0

    strPath = "C:BurnTemp"

     

    Set objDiscMaster = WScript.CreateObject("IMAPI2.MsftDiscMaster2")

    Just as before, we'll begin by telling our script to set a few variables.  We'll provide the index number of the drive we wish to use to burn our CD along with a path to the files that should be added.

    We'll also create a reference to the IMAPI DiscMaster object.  This object returns a collection of all the optical devices on the system.

    Set objRecorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2")

    strDevice = objDiscMaster.Item(Index)

    objRecorder.InitializeDiscRecorder(strDevice)

    Next, we'll create a reference to the device we'll be using to record our CD.  The MsftDiscRecorder2 namespace returns an object that represents a recording device.  We'll then get a string that contains a unique ID for the device we wish to use.  Finally, we'll use the InitializeDiscRecorder method to bind the recorder object to the actual device on the system.

    Set objImageWriter = CreateObject("IMAPI2.MsftDiscFormat2Data")

    objImageWriter.Recorder = objRecorder

    objImageWriter.ClientName = "Multisession CD"

    Once a reference exists to a burning device, an ImageWriter object can be created to actually do the work.  The Recorder property is used to indicate what recording device to use, and the ClientName property is used to provide a friendly name.  This is the object that will be used to create an image of the current session and provide that to the recorder for writing.

    Set objFSI = CreateObject("IMAPI2FS.MsftFileSystemImage")

    At this point, set up of the disc and current recording session is complete.  It's now time to begin creating an image of the current burn session.

    More Windows Scripting Articles
    More By Nilpo


     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT