Shared Libraries with ASP / WSH

I'm developing a library of JavaScript functions (could just as easily be VBScript).  Right now, they're in a file called lib.js that can be included in a WSH .wsf file via the SCRIPT tag.

If I convert lib.js file to lib.asp by adding SCRIPT tags within the file itself, I can include lib.asp in other ASP scripts (but then I can no longer use it with WSH).

I hate the thought of manually keeping these two files in sync.  While I could write a short script to add the necessary wrapper around the .js file, that's an ugly hack at best.  How can I combine lib.js & lib.asp into ONE file that can be included from BOTH ASP and WSH?
LVL 1
djschaapAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sybeCommented:
i never tried this, but create 2 files for include with asp, with just the tags.

===========
file starttag.inc
===========
<%
===========

===========
file endtag.inc
===========
%>
===========

then in asp include like this:
<!--#include file="starttag.inc"-->
<!--#include file="yourlib.asp"-->
<!--#include file="endtag.inc"-->
0
djschaapAuthor Commented:
Nice thought, but:

using <%  %> tags:
Active Server Pages, ASP 0116 (0x80004005)
The Script block lacks the close of script tag (%>).
/.../start.inc, line 1

using SCRIPT tags:
Active Server Pages, ASP 0117 (0x80004005)
The Script block lacks the close of script tag (</SCRIPT>) or close of tag symbol (>).
/.../start.inc, line 1


Thanks for trying!
0
sybeCommented:
and what about using the html <script> tag in your asp:

<script scr="yourlib.asp" language="jscript" runat="server"/>

(never tried that either...)
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

sybeCommented:
no, that sounds weird, it's a client tag, won't work.
0
djschaapAuthor Commented:
Nice thought, but:

using <%  %> tags:
Active Server Pages, ASP 0116 (0x80004005)
The Script block lacks the close of script tag (%>).
/.../start.inc, line 1

using SCRIPT tags:
Active Server Pages, ASP 0117 (0x80004005)
The Script block lacks the close of script tag (</SCRIPT>) or close of tag symbol (>).
/.../start.inc, line 1


Thanks for trying!
0
sybeCommented:
hmm, after all it's not so bad.

I tried this:

<script runat="server" language="vbscript" src="lib/formfunctions_2.asp"></script>

and removed the <script> tags from the include, and it seems to work...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
djschaapAuthor Commented:
(Please ignore my extra comments -- reload does more than I thought!)
0
sybeCommented:
so:....

did it work ?? because i think you got a working answer.
if so, then pls close this question.
0
djschaapAuthor Commented:
That worked!  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.