Strange behaviour with #include with script ran from command line
I have a script that uses external JS libraries which I call by the #include directive; there are four of them, an example:
#include "D:/absolute/path/to/lib/papaparse.js"Ultimately, I need to run the script from the command line; this I do with this command:
"C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\ExtendScript Toolkit.exe" -run "D:\absolute\path\myscript.jsx"The problem is that the script does not run in its entirety and it stops just when a function from the external script is called. How do I know? I have the script to write logs to text files at certain points during its run.
When I run the script from the Extend Script ToolKit (ESTK)directly, it runs OK (ie. the functions from the external scripts are used without any issues).
Why is there a problem when run from the command line and can it be resolved while still keeping external scripts linked to the main script? (I tried to copy all the code of the external scripts to the main script but it leads to some new problems that would take quite some time to resolve so I am trying to avoid this way if possible.)
Also, when trying to find out where the problem is I met with this behaviour for various forms of paths to the external scripts:
(1) paths to the external files relative (eg. /lib/papaparse.js)
– runs OK from the ESTK
– from the command line, it only starts indesign but does not run further
(2) paths to the external files absolute (eg. D:/absolute/path/to/lib/papaparse.js)
– runs OK from the ESTK
– from the command line, it runs but there are issues with loading the external files
Thanks for any advice.
