ActiveXAutomation and imapi2
Posted: Fri Aug 07, 2009 1:25 pm
by Peter Haigh >> Wed, 21 Jan 2009 0:40:18 GMT
Hi, I am attempting to use imapi2.dll (microsoft) to write to a cd recorder using jade.
I have imported the dll as an automation library and I am having problems creating an instance of an ActiveXAutomation class.
Has anyone else had any experience with this?
The error I receive is Agent error (1014), when the code "create recorder transient" is executed.
vars
master: MsftDiscMaster2 ;
recorder: MsftDiscRecorder2 ;
id: String ;
begin
create master transient ;
id := master.item(0) ;
create recorder transient ;
epilog
delete master ;
delete recorder ;
end;
equivalent code from the Microsoft website below.
Const IMAPI_PROFILE_TYPE_CDROM = &H8
Const IMAPI_PROFILE_TYPE_DVDROM = &H10
Const IMAPI_PROFILE_TYPE_CD_RECORDABLE = &H9
Const IMAPI_PROFILE_TYPE_DVD_PLUS_RW = &H1A
Set colDiscMaster = CreateObject("IMAPI2.MsftDiscMaster2")
For Each Id In colDiscMaster
Set objRecorder = CreateObject("IMAPI2.MsftDiscRecorder2")
objRecorder.InitializeDiscRecorder Id
WScript.Echo "Vendor: " & objRecorder.VendorId
Wscript.Echo "Product ID: " & objRecorder.ProductId
Wscript.Echo "Product Revision: " & objRecorder.ProductRevision
For Each strMountPoint In objRecorder.VolumePathNames
Wscript.Echo "First Mount Point: " & strMountPoint
Exit For
Next
For Each Profile In objRecorder.SupportedProfiles
Select Case Profile
Case IMAPI_PROFILE_TYPE_CDROM
Wscript.Echo "IMAPI_PROFILE_TYPE_CDROM"
Case IMAPI_PROFILE_TYPE_DVDROM
Wscript.Echo "IMAPI_PROFILE_TYPE_DVDROM"
Case IMAPI_PROFILE_TYPE_CD_RECORDABLE
Wscript.Echo "CD-R"
Case IMAPI_PROFILE_TYPE_DVD_PLUS_RW
Wscript.Echo "DVD+RW"
End Select
Next
Wscript.Echo
Next
Can anyone see where I am going wrong, or point me in the direction of a solution?
Thanks in anticipation.
Hi, I am attempting to use imapi2.dll (microsoft) to write to a cd recorder using jade.
I have imported the dll as an automation library and I am having problems creating an instance of an ActiveXAutomation class.
Has anyone else had any experience with this?
The error I receive is Agent error (1014), when the code "create recorder transient" is executed.
vars
master: MsftDiscMaster2 ;
recorder: MsftDiscRecorder2 ;
id: String ;
begin
create master transient ;
id := master.item(0) ;
create recorder transient ;
epilog
delete master ;
delete recorder ;
end;
equivalent code from the Microsoft website below.
Const IMAPI_PROFILE_TYPE_CDROM = &H8
Const IMAPI_PROFILE_TYPE_DVDROM = &H10
Const IMAPI_PROFILE_TYPE_CD_RECORDABLE = &H9
Const IMAPI_PROFILE_TYPE_DVD_PLUS_RW = &H1A
Set colDiscMaster = CreateObject("IMAPI2.MsftDiscMaster2")
For Each Id In colDiscMaster
Set objRecorder = CreateObject("IMAPI2.MsftDiscRecorder2")
objRecorder.InitializeDiscRecorder Id
WScript.Echo "Vendor: " & objRecorder.VendorId
Wscript.Echo "Product ID: " & objRecorder.ProductId
Wscript.Echo "Product Revision: " & objRecorder.ProductRevision
For Each strMountPoint In objRecorder.VolumePathNames
Wscript.Echo "First Mount Point: " & strMountPoint
Exit For
Next
For Each Profile In objRecorder.SupportedProfiles
Select Case Profile
Case IMAPI_PROFILE_TYPE_CDROM
Wscript.Echo "IMAPI_PROFILE_TYPE_CDROM"
Case IMAPI_PROFILE_TYPE_DVDROM
Wscript.Echo "IMAPI_PROFILE_TYPE_DVDROM"
Case IMAPI_PROFILE_TYPE_CD_RECORDABLE
Wscript.Echo "CD-R"
Case IMAPI_PROFILE_TYPE_DVD_PLUS_RW
Wscript.Echo "DVD+RW"
End Select
Next
Wscript.Echo
Next
Can anyone see where I am going wrong, or point me in the direction of a solution?
Thanks in anticipation.