Post by JJ Post by JJ
Any way or trick to execute JScript code from VBScript code in a VBS
file, or execute VBScript code from JScript code in a JS file?
FYI, I already know about VBScript & JScript cross language execution
via HTML, HTA, and WSF files. I want to know if it's also possible from
a VBS or JS file.
And I don't mean to execute the other language by executing a different
file type. e.g. run "cscript.exe thecode.js" from VBScript. But to
actually call a function provided from the other language.
This is nonsense, as text-files containing a script in VBS or JS or any
other scripting language cannot execute by themselves.
You will have to use a scripting engine, and "give" that engine the content
of such file to execute.
Now, most modern browsers will execute a text-file or text-stream with JS in
it, [and Microsoft's old and defunct browser will also execute VBS.]
Some web-servers, notably Windows-server, will execute files with JS [in an
old form, called "jscript"] or VBS in it, before sending the resulting
stream to the client browser.
The engine that will do both, and will execute functions defined in the
other language is the ASP-engine.
So here you can make a JS-function and execute it in the VBS-code as were it
a VBS-function. The extension that accepts such a file is usualy .asp, but
you can programme the server engine to accept any other extension, like
.html or .xyz3.
VBS and JS can be executed on a windows machine by the Cscript/Jscript-
engine, but not both at the same time.
A large number of other programmes can execute some version of JS.
VB and VBA are related, but other languages thsn VBS
and are o.t. in this NG. JS as such is o.t. too]
(Please change the x'es to dots in my emailaddress)