combine 2 Engine

May 18, 2014 at 5:21 PM
Hi,
Can i combine vbscript and jscript?

to use vbscript written functions in jscript for example
Coordinator
May 19, 2014 at 1:37 PM
Hi furesoft,

A ClearScript script engine is just another host object, and you can expose any host object to any ClearScript script engine. For example, if you set up your VBScript engine like this:
var vbs = new VBScriptEngine();
vbs.AddHostType("Console", typeof(Console));
vbs.Execute("sub print(x):Console.WriteLine(x):end sub");
you can use it from JScript like this:
var js = new JScriptEngine();
js.Script.vbs = vbs;
js.Execute("vbs.Execute('print(\"foo\")')");
In some cases, script items may be usable directly from another script engine:
js.Execute("vbs.Script.print('foo')");
but this is not recommended.

Good luck!