Thread-topic: (Windows) Need help with codec settings in Batch Exporter script for WSH
Hi, I have a fully working WSH script that creates a Quicktime movie from an image sequence, but get a run-time error when setting the codec settings from XML as documented in TN2120. This pops the codec settings dialog if the .xml file is not there, and that code path works fine. The runtime error is : "An event was unable to invoke any of the subscribers". I've tried this with a few codecs including the Animation Codec.
Could someone help me with this? I only found one reference to this problem in the mailing list archive, and no reply.
Below I have included the entire, fully runnable script - it only needs to be saved to a .js file and run with "cscript.exe" which is part of Windows XP.
I have marked the line that fails with "This Line Fails" below
---------------- jsQTtest.js START -------------------
// to run from the command line :
// cscript jsQTtest.js <source_image_sequence>, <destination.mov>
// Get script arguments
if (WScript.Arguments.Length >= 2) {
sourcePath = WScript.Arguments(0);
destPath = WScript.Arguments(1);
} else {
WScript.Echo("not enough parameters");
WScript.Quit();
}
// Launch QuickTime Player
var qtPlayerApp = WScript.CreateObject("QuickTimePlayerLib.QuickTimePlayerApp");
if (qtPlayerApp == null) {
WScript.Echo("Unable to launch QuickTime Player!");
WScript.Quit();
}
var qtPlayerSrc = qtPlayerApp.Players(1);
if (qtPlayerSrc == null)
WScript.Quit();
var qtControl = qtPlayerSrc.QTControl;
// Set up the exporter and have it configured
var qt = qtPlayerSrc.QTControl.QuickTime;
qt.Exporters.Add();
var qtExporter = qt.Exporters(1);
var CodecInfoFileName = "C:\codecinfo.xml";
var FileSystemObject = WScript.CreateObject("Scripting.FileSystemObject");
var CodecFileInfo;
try {
CodecFileInfo = FileSystemObject.OpenTextFile( CodecInfoFileName );
} catch(e) { } // exception is thrown if file not present
qtExporter.TypeName = "QuickTime Movie";
qtControl.CreateNewMovieFromImages( sourcePath, 30, true );
var qtMovie = qtControl.Movie;
qtExporter.SetDataSource( qtMovie );
if ( CodecFileInfo ) { // from TN2120
var NewSettings = WScript.CreateObject("QTOLibrary.CFObject.1");
var xmlCodecInfoText = CodecFileInfo.ReadAll();
NewSettings.XML = xmlCodecInfoText;
qtExporter.Settings = NewSettings; // <<---- This Line Fails
} else {
qtExporter.ShowSettingsDialog();
// save the settings back to disk for next time
var theText = qtExporter.Settings.XML;
CodecFileInfo = FileSystemObject.CreateTextFile( CodecInfoFileName );
if ( CodecFileInfo ) {
CodecFileInfo.WriteLine(theText);
CodecFileInfo.Close();
}
}
qtExporter.DestinationFileName = destPath;
qtExporter.ShowProgressDialog = true;
qtExporter.BeginExport();
qtPlayerSrc.Close();
---------------- jsQTtest.js END -------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden
This email sent to email@hidden