Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling one script from within another

Status
Not open for further replies.

KeithTrangmar

Programmer
Jan 16, 2004
29
GB
This might seem like an obvious one, but it's not quite how it sounds.

I have two scripts which are going to run in the Windows Scripting Host environment, i.e. outside the context of a web page. Script A needs to run a function which is defined in script B, which will in turn make calls back to functions in script A.

How do I go about this? I'm sure there must be a way of doing so, but all the help I can find on the Exec and Execute methods seem to be about running other processes, not calling functions in other scripts. I know that in a web page I could just reference them all by URL in a SCRIPT tag, then treat all the functions as if they're all defined in the same place, but I can't see how to achieve the same result in pure JS.

In case it helps, script A is going to be a "static" file in which I defined all the major functions, whereas script B is actually going to be created programmatically on a daily basis, and will simply consist of a list of calls to the functions in script A, with parameters that vary each time.



Keith Trangmar
Harlend Computer Services
Maidstone, Kent. UK.
 
i think you would just call the name:

ex:
{
myfunction;
}


may be wrong, but hope it helps
 
Are you implying that I can define a "myfunction.js" and call it like that? If so, I'll give it a try.



Keith Trangmar
Harlend Computer Services
Maidstone, Kent. UK.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top