This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
My DSS scripts are becoming unmanageable due to their length thus I'd like to place the common functionalities in a separate file.
I guess that means I need to compile a .class file (as seen here https://developer.mozilla.org/en/Rhino_JavaScript_Compiler) from my DSS javascript source so that U can reference the functions contained within after an importClass command at the top of my script.
Unfortunately, this fails (java.lang.ClassNotFoundException) since org.mozilla.javascript.tools.jsc.Main cannot be found.
Is there a particular way to do this in the DSS version?
Many thanks,
--
Joshua
Why not just move it into separate JavaScript include files instead? Then you can just reference the files in your main script.
ki
Hi Ki,
I don't mind how this is actually accomplished! Do you have a reference for how to do so by any chance though? Sorry for my ignorance but I'm not so familiar with JavaScript and haven't yet been able to find any sources discussing include files in a useful manner. Thus I haven't found a way to "reference the files in my main script" yet without errors.
Thanks!
--
Joshua
You can create a separate js file that has some functions defined
// func.js
function func()
{
...........
}
Then in your main js file you can include the other js file and call functions from it:
// main.js
load("func.js");
func();