Pretty much I'm trying to replicate some of the functions from the VBS command line script in Visual Studio 2008, along with writing some of my own functions and hopefully bonding the control functions with some open source disk burning software. The plan is to make whatever I manage to get working free and open source.
So far, I've managed to make part of the program loop through the empty slots and check each one is empty, however I am experiencing continual crashes of the MediaTracker Professional software when I try to do a similar thing with used slots. Code snippet (In this case, VB.NET) below:
Imports mediatracker
Dim MTObject As New mediatracker
Dim SelectedOrganiser As mediatracker.MTOrganiser
Sub Main()
'I have multiple CenturionCD units and one Dischub, so ensure the Dischub is selected
For Each connectedOrganiser In MTObject.ConnectedOrganizers
If (connectedOrganiser.DriveCount() = 1) = True Then
Me.SelectedOrganiser = connectedOrganiser
Console.WriteLine("Selected DiscHub with drive letter " & SelectedOrganiser.DriveLetter(0).ToString() & ":")
End If
Next
This bit works fine, it detects which of my units is the DiscHub based on the fact it has a drive, and sets the global of SelectedOrganiser to the appropriate object.
The following bit of code also works fine when set directly after the above code
'Clear drive
If (SelectedOrganiser.IsDriveInUse(0)) Then
'Yes, it is..
SelectedOrganiser.EjectToCarousel(0)
End If
But when I place it inside a loop to check used slots, the MediaTracker software crashes. Example code:
Dim i As Integer
For i = 1 to SelectedOrganiser.UsedSlots.Count
'Clear drive
If (SelectedOrganiser.IsDriveInUse(0)) Then
'Yes, it is..
SelectedOrganiser.EjectToCarousel(0)
End If
Next
It seems to fail while evaluating the If statement, rather than when it tries to eject the disk to carousel, and thus far I have been unable to find any workarounds... Anyone have any ideas?
EDIT:
Am I right in assuming the DriveCount option will always be 1 for dischub units, given they only have a single drive in them? Are there any other values these might take?
I Would like a copy of this.
I have been working (albeit slowly) on a modified version which includes bits of IMAPI2 to handle burning ISOs to disk. At this point, I have a very crude program that will take a list of ISOs and corresponding MediaTracker Volume names, and cycle through the lot of them burning the appropriate ISO to each.
It is far from perfect, as the list is currently hardcoded, and there is little to zero error handling in place for when things go wrong. There are also some events that I would like to handle in code that I haven't been able to implement due largely to lack of time.
Another option which I'm testing at the moment is using ImgBurn to handle the burning and verification stages, however ImgBurn is prone to its own interesting set of bugs/quirks, and for bulk burn operations has a habit of messing up (such as dialogs popping up that cant be handled automatically, etc).
I'll see what I can do about putting code online, however not all of it is mine so I may need to cut some of it out to clear up licensing issues. If anyone would like to write a VS.NET (2008) class to burn ISOs to a dvd drive, please let me know...
EDIT:
Just to add, I'm using COM object references to MediaTracker Professional.
Figured this out for myself, turned out that not passing the Volume object, and passing the volume name instead caused the problem. Passing the volume object instead works as it should.
I now have a program that loads and unloads disks from the drive, but am still working on the event driven parts of the loops that ensure the disk that has been loaded is actually read before unloading. Time to try and understand how SCSI commands work... If anyone is interested in my VB.NET 2008 code, let me know.