VBScript and Visual Basic 
Author Message
 VBScript and Visual Basic

I can't find the answer to this anywhere.  Can VBScript be run from inside
Visual Basic?

I have written and large VBScript for doing admin work pulling OS config
info , but now the user wants a GUI front end for the script.  Can I use VB
to create a GUI and then use my script code to pull the OS data?

Steve B.



Tue, 29 Nov 2005 01:45:54 GMT  
 VBScript and Visual Basic
Yes - just bung an MSScript.OCX in one of your forms and run the script in
that.

Download
http://www.microsoft.com/downloads/details.aspx?FamilyId=D7E31492-259...

Info
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnex...

I believe (not done it) that you should be able to use WSH to run VBS
scripts from Visual Basic as well. Have a lok on Google.

Chris.


Quote:
> I can't find the answer to this anywhere.  Can VBscript be run from inside
> Visual Basic?

> I have written and large VBScript for doing admin work pulling OS config
> info , but now the user wants a GUI front end for the script.  Can I use
VB
> to create a GUI and then use my script code to pull the OS data?

> Steve B.



Tue, 29 Nov 2005 01:58:48 GMT  
 VBScript and Visual Basic

Quote:

> I can't find the answer to this anywhere.  Can VBscript be run from
> inside Visual Basic?

> I have written and large VBScript for doing admin work pulling OS config
> info , but now the user wants a GUI front end for the script.  Can I
> use VB to create a GUI and then use my script code to pull the OS data?

> Steve B.

Sort of; you have a few options if you want to integrate VBScript into VB.

One option is to actually rewrite the script as VB.  VBScript is lexically
almost identical to VB, and even at the level of procedures is almost
identical semantically; the primary difference you run into is first at
the statement level where some intrinsics for WSH are not available to VB
(you will need to translate those to VB - not a problem) and then at the
level of a complete code file there are significant structural
differences - but those should be relatively minor issues, you just wrap
your global code into a Sub Main or Sub Form_Onload, etc.

The other option is to use the Microsoft Script Control.  This lets you
leave the script as-is  and easily reconfigurable if you read it into VB
from outside, but requires a little more care in structuring.  Overall,
the first option is probably easiest.

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Microsoft's new UNIFIED Terminal Services Newsgroup:



Tue, 29 Nov 2005 02:05:00 GMT  
 VBScript and Visual Basic
LOL - great minds think alike... <g>

Quote:

> Yes - just bung an MSScript.OCX in one of your forms and run the script
> in that.
====
> I believe (not done it) that you should be able to use WSH to run VBS
> scripts from Visual Basic as well. Have a lok on Google.

Yep - intrinsic objects aren't the same.  Stepping away from the GUI
solution specifically, VBScript can be rewritten as a VB.NET console app
with almost no effort.  You have to stick all of the global code into a
Sub Main() of course and translate WScript.* intrinsics into appropriate
.NET classes, but then you can compile instantly.

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Microsoft's new UNIFIED Terminal Services Newsgroup:



Tue, 29 Nov 2005 02:15:24 GMT  
 VBScript and Visual Basic
I think you can do that using the script control (MSSCRIPT.OCX),
but it'd probably be easier to use VB to get the info. if you're using
a VB GUI.
  If you have the functionality and just need a GUI you could house
the script functions in an HTA.

--
--

Quote:
> I can't find the answer to this anywhere.  Can VBscript be run from inside
> Visual Basic?

> I have written and large VBScript for doing admin work pulling OS config
> info , but now the user wants a GUI front end for the script.  Can I use
VB
> to create a GUI and then use my script code to pull the OS data?

> Steve B.



Tue, 29 Nov 2005 02:15:01 GMT  
 VBScript and Visual Basic
Old-

Can you read in spanish?
http://www.mvps.org/vexpert/articles/XMLgenScripts1.htm

You can run VBScrips but this will run in a thread. This article say you how
to control the thread.

Bye
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Harvey Triana
Microsoft MVP Visual Basic
http://www.mvps.org/vexpert
~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Quote:
> I can't find the answer to this anywhere.  Can VBscript be run from inside
> Visual Basic?

> I have written and large VBScript for doing admin work pulling OS config
> info , but now the user wants a GUI front end for the script.  Can I use
VB
> to create a GUI and then use my script code to pull the OS data?

> Steve B.



Tue, 29 Nov 2005 05:22:26 GMT  
 VBScript and Visual Basic
Thanks all for the replies.

Finished cleaning up the code and deciding whether to rewrite as a VB app or
try pulling script code into VB with the OCX.  Someone there maybe a problem
with using the OCX since I'm using WMI heavily. So making a VB app be best
solution for long run.

Thanks again,
Steve B.


Quote:
> Yes - just bung an MSScript.OCX in one of your forms and run the script in
> that.

> Download

http://www.microsoft.com/downloads/details.aspx?FamilyId=D7E31492-259...
Quote:

> Info

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnex...
Quote:

> I believe (not done it) that you should be able to use WSH to run VBS
> scripts from Visual Basic as well. Have a lok on Google.

> Chris.



> > I can't find the answer to this anywhere.  Can VBscript be run from
inside
> > Visual Basic?

> > I have written and large VBScript for doing admin work pulling OS config
> > info , but now the user wants a GUI front end for the script.  Can I use
> VB
> > to create a GUI and then use my script code to pull the OS data?

> > Steve B.



Thu, 01 Dec 2005 02:44:13 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. vbscript in Visual Basic

2. How to run VBScript in Visual Basic ???

3. vbscript vs visual basic

4. Running WSH VBScripts in Visual Basic

5. passing array from VBScript to Visual Basic ActiveX DLL

6. How to run VB-Scripts in Visual Studio - Visual Basic 6

7. Visual Basic And VBScript control ocx

8. Using Visual Basic form in VBScript

9. Visual Basic and VBScript control ocx

10. compiling vbscript scripts in Visual Basic?

11. Do visual basic and vbscript have equal access to the Office97/2000 object model

12. conversion of type constructor of visual basic in vbscript

 

 
Powered by phpBB® Forum Software