Elementary WSH Scripting Question - Adding Automation Classes

G

Guest

I picked up the script below somewhere on microsoft.com/msdn for making use
of the IMAPI interface to do what I always wanted - interact with my CD
burner programmatically.

When I attempt to run it (WinXP Home SP2), I get an error message indicating
that the Automation Class is not loaded. After a few hours of searching MSDN
and Microsoft.com in general, downloading script debuggers, etc. I am giving
up on myself finding the answer of what to do next. Can any kind person here
help me?

Thanks in advance.

------
' This script examines the burn device characteristics such as
' product ID, product revision level, feature set, and profiles.

' Copyright (C) Microsoft Corp. 2006

Option Explicit

' Constants
const IMAPI_FEATURE_PAGE_TYPE_DVD_DASH_WRITE = 47

WScript.Quit(Main)

Function Main
Dim Index ' Index to recording drive.
Dim Recorder ' Recorder object
Dim Path ' Directory of files to burn
Dim Stream ' Data stream for burning device

Index = 1 ' Second drive on the system

' Create a DiscMaster2 object to connect to CD/DVD drives.
Dim g_DiscMaster
Set g_DiscMaster = WScript.CreateObject("IMAPI2.MsftDiscMaster2")

' Create a DiscRecorder object for the specified burning device.
Dim uniqueId
set recorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2")
uniqueId = g_DiscMaster.Item(Index)
recorder.InitializeDiscRecorder( uniqueId )

' *** - Formatting to display recorder info
WScript.Echo "--------------------------------------------------"
Wscript.Echo " ActiveRecorderId: " & recorder.ActiveDiscRecorder
Wscript.Echo " Vendor Id: " & recorder.VendorId
Wscript.Echo " Product Id: " & recorder.ProductId
Wscript.Echo " Product Revision: " & recorder.ProductRevision
Wscript.Echo " VolumeName: " & recorder.VolumeName
Wscript.Echo " Can Load Media: " & recorder.DeviceCanLoadMedia
Wscript.Echo " Device Number: " & recorder.LegacyDeviceNumber

Dim mountPoint
For Each mountPoint In recorder.VolumePathNames
WScript.Echo " Mount Point: " & mountPoint
Next

WScript.Echo "Supported Features" 'in _IMAPI_FEATURE_PAGE_TYPE
Dim supportedFeature
For Each supportedFeature in recorder.SupportedFeaturePages
if supportedFeature = _
IMAPI_FEATURE_PAGE_TYPE_DVD_DASH_WRITE then
WScript.Echo " Feature: " & supportedFeature & _
" Drive supports DVD-RW."
else
WScript.Echo " Feature: " & supportedFeature
end if
Next

WScript.Echo "Current Features" 'in _IMAPI_FEATURE_PAGE_TYPE
Dim currentFeature
For Each currentFeature in recorder.CurrentFeaturePages
WScript.Echo " Feature: " & currentFeature
Next

WScript.Echo "Supported Profiles" 'in _IMAPI_PROFILE_TYPE
Dim supportedProfile
For Each supportedProfile in recorder.SupportedProfiles
WScript.Echo " Profile: " & supportedProfile
Next

WScript.Echo "Current Profiles" 'in _IMAPI_PROFILE_TYPE
Dim currentProfile
For Each currentProfile in recorder.CurrentProfiles
WScript.Echo " Profile: " & currentProfile
Next

WScript.Echo "Supported Mode Pages" 'in _IMAPI_MODE_PAGE_TYPE
Dim supportedModePage
For Each supportedModePage in recorder.SupportedModePages
WScript.Echo " Mode Page: " & supportedModePage
Next

WScript.Echo
WScript.Echo "----- Finished content -----"
Main = 0
End Function
 
D

Doug Knox - [MS-MVP]

You may want to try posting this to the scripting newsgroup.

--
Doug Knox, MS-MVP Windows Media Center\Windows Powered Smart
Display\Security
Win 95/98/Me/XP Tweaks and Fixes
http://www.dougknox.com
 
G

Guest

Doug,

Thanks. I posted it to microsoft.public.scripting.wsh. I was looking for a
more appropriate location than this general category. I was finding the
Microsoft reorganization of the newsgroups interface to be fairly challenging
to navigate. It seems you can't actually search for a newsgroup but you have
to browse and getting to the list to browse comes via a link well at the end
of the page.

In addition to what I posted yesterday, I noted in the posting in
scripting.wsh that I did this further work:
----
I spent some time investigating my system's installation of IMAPI. I have
version 5.1.2600.2180. I am suspicious that I do not have IMAPI v2 and that
perhaps that is limited to Vista. I tried just removing the "2"s from the
object class cited and that lead to the same message.

I have searched high and low on Microsoft.com for any updates and downloads
related to IMAPI. Other than some documents describing IMAPI, I did not find
anything. In fact, in the whole website and many component areas there are
very few hits and none of them seem to be helpful.
 
S

Shenan Stanley

Buchs said:
Thanks. I posted it to microsoft.public.scripting.wsh. I was
looking for a more appropriate location than this general category.
I was finding the Microsoft reorganization of the newsgroups
interface to be fairly challenging to navigate. It seems you can't
actually search for a newsgroup but you have to browse and getting
to the list to browse comes via a link well at the end of the page.

Stop using the horrible web interface and actually utilize a legitimate
newsreader instead. Your life on the newsgroups will become much more
enjoyable. Even if your choice of newsreader is nothing more than Outlook
Express (for example) - things will be better than if you utilized the web
interface for these newsgroups.

Example:
Setting up Outlook Express Newsreader for MShttp://www.michaelstevenstech.com/outlookexpressnewreader.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top