run vbscript from vb.net code

  • Thread starter Thread starter Josh
  • Start date Start date
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
 
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
 
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
 
* "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).
 
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
 
Back
Top