Regarding render template bug.

hdguru wrote on 3/10/2005, 11:59 AM
I read the posts regarding solution to the render template bug where you open the render dialog manually in order for the script to find the render template. I am trying to simulate that with sendkeys, but it doesn't seem to fix the problem. Can I just use sendkeys to open the render template dialog, so the script could then find the render template?

Comments

jetdv wrote on 3/10/2005, 2:27 PM
No. That won't work.

I'm not 100% sure which error you are referring to but if it's the one I think it is, it was fixed in the latest releases so it shouldn't be an issue. Plus, an error catch in the script let's you get past it.
johnmeyer wrote on 3/10/2005, 10:43 PM
hdguru contacted me via email. Here is my reply to his problem:

In my final post in the thread you reference (5.0b breaks scripts), here is the code that I changed:
    function FillTemplateTree() {
var renderers = new Enumerator(Vegas.Renderers);
while (!renderers.atEnd()) {
var renderer = renderers.item();
var rendererNode = new TreeNode(renderer.FileTypeName);
rendererNode.Tag = renderer;
templateTree.Nodes.Add(rendererNode);
var templates = new Enumerator(renderer.Templates);
while (!templates.atEnd()) {
try {
var template = templates.item();
var templateNode = new TreeNode(template.Name);
var tag = new Object();
tag.renderer = renderer;
tag.template = template;
templateNode.Tag = tag;
rendererNode.Nodes.Add(templateNode);
templates.moveNext();
} catch (e) {
templates.moveNext();
}
}
renderers.moveNext();
}
}
===================
This was the original code:
    function FillTemplateTree() {
var renderers = new Enumerator(Vegas.Renderers);
while (!renderers.atEnd()) {
var renderer = renderers.item();
var rendererNode = new TreeNode(renderer.FileTypeName);
rendererNode.Tag = renderer;
templateTree.Nodes.Add(rendererNode);
var templates = new Enumerator(renderer.Templates);
while (!templates.atEnd()) {
var template = templates.item();
var templateNode = new TreeNode(template.Name);
var tag = new Object();
tag.renderer = renderer;
tag.template = template;
templateNode.Tag = tag;
rendererNode.Nodes.Add(templateNode);
templates.moveNext();
}
renderers.moveNext();
}
}
The first half of the function, before and after the change, is identical.
The change begins immediately after the:
while (!templates.atEnd()) {
statement. All I did was nest all the code that is executed by the While statement inside a "Try/Catch" construct. I don't program much anymore, so I wasn't familiar with this syntax, but all it does is set up an error trap so that if something goes wrong during any of the lines of code between the "try" and the "catch," execution will branch to the catch. As you see, all I did was add an additional
templates.moveNext();
statement, which is the statement to the catch that keeps going through the entire list of templates. Thus, the script is still generating an error, thanks to the bug in Vegas, but the script keeps on going to the next template.
jetdv wrote on 3/11/2005, 7:02 AM
Well... at least I WAS thinking of the right bug!