It's all about name scope.
Let's say in the body of your jscript you name a variable or function "foo", and then there is also a variable or function named "foo" in the file you include. Since jscript is copy/paste of text, your two foos are going to conflict and cause errors. Jscript can't tell the difference between your local foo and imported foo.
In Python, when you import a file, all it's variables and functions are imported in the namespace of that file (very much like Model Space in XSI!). So if your file is named "myLib" then it's foo variable or function will be "myLib.foo".
So for Jscript, if you intend to do any including, you *must* name all your variables and functions something likely to be unique. It forces annoyingly long variable and function names.
On Feb 3, 2008 3:11 PM, Stephen Blair <
Stephen_Blair(at)softimage.com> wrote:
Yeah, like this you mean?
<script type="text/_javascript_" src="">
How is the Python way object-oriented?
The html way is pretty much just like #include in C++ or C.
There *is* include in jscript if you are writing for netview.
However, it must be considered as literally cut and paste of text, it's not an object oriented include the way it would be in Python.
On Feb 3, 2008 7:42 AM, Stephen Blair <
Stephen_Blair(at)softimage.com> wrote:
Hi Franky
There is no such feature in Jscript.
Some people use eval. See "The Include() Function" section here:
http://digivation.net/programming/registrytools
Another approach (used by the SDK Wizards) is to have a custom object
that provides features used by all the different wizards.
So each wizard calls a command to create an instance of the helper
object, and then calls methods on the helper object.
// Steve
// Team Lead, XSI Customer Support
//
// See the XSI wiki for KB articles, FAQs, and more...
// softimage.wiki.avid.com/Category:Support
-----Original Message-----
From:
owner-xsi(at)Softimage.COM [mailto:
owner-xsi(at)Softimage.COM] On Behalf
Of Frank Lenhard
Sent: Sunday, February 03, 2008 8:36 AM
To:
XSI(at)Softimage.COMSubject: ?include? in jscript?
Hi scripters,
i dont know if something like i whish for exists in jscript. so far i
didnt found any info.
what i basically want is writing functions in ONE script and include
that script with one nifty line like "include c:\1.jscript" into the
current script and have all the functions declared in 1 available in
script 2.
would keep the scripting much eaasier to read and navigate, then to
mess with thousands of lines of code.
ciao
franky
---
Unsubscribe? Mail
Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi
---
Unsubscribe? Mail
Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi