troubleshooting Question

Sharing include files

Avatar of Bob3975
Bob3975Flag for United States of America asked on
Web Languages and StandardsASP
2 Comments1 Solution856 ViewsLast Modified:
The asp application in question is written in javascript.  Recently a large block of code was imported into a subdirectory and it's an asp app written in vbscript.  From the javascript app the user clicks a link that targets a seperate page in the imported vbscript code so everything works fine at that stage.

Now I wish to include a function from the vbscript code on a page in the main javascript code.  The timeline goes like this 1) there's a serverside javascript file for the main javascript app which already contains vbscript code at the end under a <SCRIPT LANGUAGE="VBScript" RUNAT="SERVER"> tag, 2) I copied the function needed into that section, 3) of course it calls a function that calls a function that calls ... you get the picture, 4) I start copying these other functions, 5) it becomes obvious that's not going to be very managable.

I'd like to include the vbscript files into my serverside javascript under the <SCRIPT LANGUAGE="VBScript" RUNAT="SERVER"> tag.  There are asp files written in vbscript already used as include files.  The inclusion is written something like...

blah blah blah %>
<!--#include file="functions/functions_code.asp"-->
more blah blah blah

functions/functions_code.asp is written like...
blah blah blah

In the javascript file, the <SCRIPT LANGUAGE="VBScript" RUNAT="SERVER"> looks something like...

 js code}
Function x(y)

Therefore the question becomes, how do I share multiple vbscript include files between the two apps?  When included with vbscript, the enclosing <% and %> tags are needed.  When in the javascript file under the <SCRIPT LANGUAGE="VBScript" RUNAT="SERVER"> tag, these are not wanted.

I started to use the following, thinking I'd write code to strip the <% and %> tags...
Include "somecode.vbs"
Sub Include(sCodeFile)
  Dim sCode
  with createobject("scripting.filesystemobject")
    sCode = .OpenTextFile(sCodeFile).ReadAll
  End With
  ExecuteGlobal sCode
End Sub
but stopped short wondering if this was applicable since I had multiple include files.

This has to be easy, right?  How do I share these include files?  

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros