We are using interop.msscriptcontrol.dll to execute simple VBScript variables code ("Today - 1" kind of stuff). Our application is non-COM components except for this one. We have searched for a .Net replacement of VBScript, but we've been unable to find one.
Is there a VBScripting replacement for .Net?
In the following example, I will make the WebBrowser control evaluate the VBScript expression "Now - 1" and embed the result in the WebBrowser's document.title so I can fetch it in C#:
WebBrowser wb = new WebBrowser();
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(
(object _sender, WebBrowserDocumentCompletedEventArgs _e) =>
{
MessageBox.Show(wb.Document.Title);
}
);
wb.DocumentText = @"
<HTML>
<HEAD>
<TITLE>Hello</TITLE>
<SCRIPT language=""VBScript"">
document.title = Now - 1
</SCRIPT>
</HEAD>
<BODY/>
</HTML>";
Obviously, this approach suffers from:
My gut feeling is this approach is potentially worse than the approach you're currently using.
I ended up using the free Codefluent runtime engine to replace msscriptcontrol.dll:
http://www.softfluent.com/products/codefluent-runtime-client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With