I write my scripts such that they always have the entire code in a function call, Basically, the only piece of code outside the main function call is calling that main function (so that I can test and debug each script separately). Then, when I use #include <scriptname.jsx> I can use that same script from another one. Normally, I write one overall script that installs the various commands in menus and contains the switch for the command function that calls each of the separate scripts, all of which are included via the #include. Save that overall script as binary and you do not need to drag all the scripts into the startup directory.
Kind regards from c-c-c-c-cold Netherlands
Can you further explain:
Save that overall script as binary and you do not need to drag all the scripts into the startup directory.
When I use #include <scriptname.jsx>, I get the following error:
Script Error :
Error Message : File or folder does not exist
Script, Line# : C:\path\to\script\overall_script.jsx, 1
This happens even when the two scripts are in the same folder.
Thanks in advance,
If this works when running the main script from the ESTK, you know it finds the included script. When you then Export the script to Binary (from the File menu of the ESTK), the binary will include the embedded script as well. After this you have a jsxbin file, which you can drop into one of the two available startup folders to make it fire automatically when FM starts. Or you can move it anywhere else and run it via the File > Script > Run command. The main idea here is that when compiling a script into binary format, all include references are resolved and the script contains the complete code. If you run the jsx, the script is interpreted and requires a correct relative reference to any included script.
I hope this clarifies things a little
Thanks for all your help! One last question, is it possible to include a script from a network server?
For example, something like
Just to be clear, what I would like to be able to do is modify the scripts called by overall_script.jsx without having to remake the binary file every time.