Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

VBScript: How do I import another VBS file as an include?

Posted on 2005-03-02
4
Medium Priority
?
732 Views
Last Modified: 2008-02-01
VBScript: How do I import another VBS file as an include?

If there is a uniform way to do it, I would like to know how? If not, I would like to know if there is a back door way to perform this. Thanks.
0
Comment
Question by:HackLife
  • 2
4 Comments
 
LVL 4

Author Comment

by:HackLife
ID: 13442366
Well, I figured it out, but I still would like to give the points away. I need to understand what are the difference between these:

Eval

ExecuteGlobal

Execute

and how to use them.

I found this in another board:

Include "somecode.vbs"

Sub Include(sCodeFile)
  Dim sCode
  with createobject("scripting.filesystemobject")
    sCode = .OpenTextFile(sCodeFile).ReadAll
  End With
  ExecuteGlobal sCode
End Sub
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 13442391
Why not just set the vbsfile as a Constant:

Dim wshell

Const VBSFILE = "Somefile.vbs"

Set wshell = CreateObject("WScript.Shell")

wshell.Run VBSFILE

Set wshell = Nothing
0
 
LVL 4

Accepted Solution

by:
lotsofish earned 1000 total points
ID: 13442710
0
 
LVL 4

Author Comment

by:HackLife
ID: 13443183
Because I'm including classes and "run" will not help any.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question