Invoke .js from .cs?

sol wrote on 7/20/2007, 3:38 PM
I am trying to combine two scripts, one written in C#, and one in javascript. I want to pass some arguments from the C# script and run the .js script. Something like so:

(from the .cs file)
Process.Start("test.js", string1, string2);

This doesn't seem to work though, as I get Windows Script Host Syntax errors. How can I get Vegas to run the .js file instead of WSH taking over?

Alternatively, how can I go about converting the .js code into C# so I can combine it into the .cs file?

Comments

jetdv wrote on 7/20/2007, 8:18 PM
You cannot start another script from within a script. You'll need to convert the .js and embed it within the .cs.

The code between the two is VERY similar. It shouldn't be that difficult to do so. However, it's tough to tell you *how* to do this without more information.
jetdv wrote on 7/24/2007, 2:51 PM
I haven't tested this code (I'm getting the renderer a different way since moving to c# that's been more reliable for me than that was in JScript). But you can try this:

Add this to the top:
using System.Text.RegularExpressions;

And then your function would be:


public Renderer FindRenderer(Regex rendererRegExp)
{
foreach (Renderer renderer in Vegas.Renderers)
{
if (null != rendererRegExp.Matches(renderer.FileTypeName))
{
return renderer;
}
}
return null;
}