I'm using JINT to load a javascript file into a small C# app and call a number of methods with some parameters from C#. I want to get the return values of those methods. This is what I'm doing:
JintEngine engine = new JintEngine();
string file = File.ReadAllText(@"C:\thejavascript.js");
engine.Run(file);
Console.WriteLine(engine.CallFunction("themethod"));
The javascript method is as follows:
function themethod() {
console.log("Hello!");
return "Finished";
}
I can see 'Finished' in the VisualStudio console when I run the code above, but the call to send 'Hello!' to the AS3 console is nowhere to be seen. It's not in the flashlog.txt file even. In fact, I think JINT throws an error, as the may not be a 'console' object in existance since there's no browser.
How can I trap what's sent to the console from javascript that's run in JINT? There is an example on the JINT download site that had SystemConsole' or something (not System.Console), but I have not been successfu in getting this to work. I want to be able to add debugging code to the javascript and see it in the console in VisualStudio.
Any ideas? This is making debugging what I'm doing very difficult. . .
Thanks in advance.