Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - Burning CDs in Windows XP with WSH
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 CDs in Windows XP with WSH
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-10-27

    Table of Contents:
  • Burning CDs in Windows XP with WSH
  • Behind the CD Writing Wizard
  • Building the Script
  • Finishing Up

  • 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 CDs in Windows XP with WSH - Behind the CD Writing Wizard


    (Page 2 of 4 )

    The CD Writing Wizard in Windows XP doesn’t actually write CDs.  Instead, it provides a GUI interface to the underlying shell APIs.  Automating this wizard then becomes the only native way of accessing the necessary APIs from a script.

    The WScript Shell object provides methods of automating GUI elements.  It allows you to activate open windows on the system and send keystrokes to those applications.  By taking advantage of keyboard shortcuts, you can respond to the user dialogs provided by the CD Writing Wizard and effectively automate it so that it can be run unattended from a script.

    Using the CD Writing Wizard is pretty simple.  You can select the files or directories you wish to burn from My Computer or Windows Explorer.  You can then copy them to a temporary virtual directory by selecting your CD device from the Send To menu.  This is the virtual directory where the CD Writing Wizard looks for files when creating a CD image to burn.  The location of this directory is found in the registry key below.

    HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerShell FoldersCD Burning

    In order to automate this wizard, we first need to determine the location of the virtual CD directory by reading the registry key above.  Then, we can copy the files we wish to burn to that directory.  Finally, we can launch the CD Wizard and move through it by sending keystrokes to the application, effectively simulating the steps a user would take to perform the same action.

    strDriveLetter = "E:"

     

    strSourceDirectory = "C:Documents and SettingsNilpoMy Documents"

    strCDName = "MyDocs"

    We’re now ready to begin putting our script together.  The example script I’ll be creating in this article is going to burn a directory of files.  Start by creating a few necessary variables that include the drive letter of the CD-RW device, a directory path containing the files to be written to CD, and a name for the CD.

    The CD name should be limited to sixteen characters or less.

    If you are using this in your script as a method of creating backups, you may wish to consider using the current date as a part of your CD name.

    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 6 Hosted by Hostway
    Stay green...Green IT