Help with Batch Render Dialog using Javascript

wwaag wrote on 2/18/2016, 5:04 PM
First, I am NOT a script writer (obviously LOL). I am just trying to re-purpose an old Batch Render script written by John Meyer. Basically, I just want to extract the Batch Render GUI and use it another script, also written in javascript. It's working OK except that the file extension is the Default extension. E.g., if I select an XAVC S template, it renders OK except that it adds the .mxf extension rather than the correct MP4 extension. Here is the part of the code where I extract the renderer, template, and file extension.

var dlog = new BatchRenderDialog();

if (DialogResult.OK == dlog.ShowDialog()) {
var selectedTemplates = dlog.GetCheckedTemplates();
// inform the user of some special failure cases
if (0 == selectedTemplates.Count)
throw "no render templates selected";
if (2 <= selectedTemplates.Count)
throw "only 1 render template can be selected";

var selections = new Enumerator(selectedTemplates);
var tag = selections.item(0);
var RendererName = tag.renderer;
var TemplateName = tag.template;
var Extension = tag.renderer.FileExtension.substring(1);
}
RendererName = RendererName.replace(/ *\([^)]*\) */g, "");

MessageBox.Show ("Renderer", RendererName);
MessageBox.Show ("Template", TemplateName);
MessageBox.Show ("Extension", Extension);

// Assign a filename for the rendered event, same as event then add an increment

var file : String = morphDir + "\\" + ve.ActiveTake.Name + "-" + Extension;//

// Next check for duplicate file names and increments the counter
// until an unused file name is found.
var eventNum : int = 1;
while (File.Exists(file + "-" + String.Format("{0:D3}", eventNum) + "." + Extension)) {
eventNum++;
}
file = file + "-" + String.Format("{0:D3}", eventNum) + "." + Extension;

// Use the above assigend render template to render the video

VegasRenderTemplate = Vegas.Renderers.FindByName(RendererName).Templates.FindByName(TemplateName);

MessageBox.Show ("template", VegasRenderTemplate);


The message boxes are just for diagnostics. Again, it does render properly--just the extensions are wrong. Can this even be done in javascript, and if so, can you gently point me in the proper direction. Much thanks.

wwaag

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Comments

altarvic wrote on 2/19/2016, 5:35 AM
You should extract the extension from the render template, try this:
var Extension  = String(tag.template.FileExtensions[0]).substring(1);
wwaag wrote on 2/19/2016, 10:52 AM
Thank you so much. Things seem to be so easy once you know how. Problem solved.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.