[JS] How to speed up file operations in InDesign script?
The script I have on my computer takes around 6 minutes to run. I used $.hiresTimer to measure the time that each line of code takes to run. It turns out the file operations are taking the bulk of my time in my script.
For example this line of code:
var titlePage = app.open(file, Boolean.false, OpenOptions.OPEN_COPY);
takes 3 seconds to execute.
Here I save the file and it takes 5 seconds to execute:
titlePage.save(file, Boolean.false, "saved", Boolean.true);
titlePage.close(SaveOptions.YES);
My system has SSD drives and I have not noticed any file performance issues. My script does these open/save/close operations 52 times.
If anyone has any tips on how to improve the above file operations I would be very appreciative. Saving a even a half second per file operation could make a big difference to the overall script running time.
Thank you in advance for any help provided!
