run vbscript from vb.net code

J

Josh

How can I run vbscript code from vb.net code? In particular I want to run
ExecutGlobal to exexute some vbscript that is read from a file, and then run
that vbscript functions in the script to test them from my vb.net program.
TIA
Josh
 
C

Cor

Thanks for letting us know Josh,

Mostly Herfried answers this kind of questions standard, but it seems he is
busy this week.

(No mid day route passing the newsgroups)

Cor
 
J

Josh

Cor:
Sure.
Only catch is I have to use ExecuteStatement to run the script and then use
Eval to execute each function defined in the script.
Josh
 
H

Herfried K. Wagner [MVP]

* "Josh said:
How can I run vbscript code from vb.net code? In particular I want to run
ExecutGlobal to exexute some vbscript that is read from a file, and then run
that vbscript functions in the script to test them from my vb.net program.

If the code resides in a file, you may want to try this code:

\\\
Imports System.Diagnostics

..
..
..
Dim psi As New ProcessStartInfo()
psi.UseShellExecute = True
psi.FileName = "C:\bla.vbs"
Process.Start(psi)
..
..
..
///

Alternatively, you can use the MS Script Control (but you already found
that out in the meantime).
 
J

Josh

Herfried:
Thanks, but would I then be able to run the functions defined in the script?
The VB script file only defines functions, it does not actually do anything.
I need to test the functions programmatically sending them parameters, and
retreive the result (which is always a string).
The way I described with the MSScriptControl, using Execute statement to run
the script, and then calling the functions using Eval does work for that
purpose.
Josh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top