@boom-shanka – Hm. Your code is not the problem.
I just tested this and I can see this as well.
We have to go through this error one step after another.
Let's do not an export for the moment and only define the export parameters of the CSS and JS file.
Then do the export in the UI.
Here my experience:
As you can see there is an external CSS and JS file in the same folder of my InDesign document:
Then I ran a code similar like yours to define the paths of the external CSS and JS files.
Now, if you open the export dialog for fixed layout EPUB you can see, that the paths are set:
However, exporting will show you an error message after hitting the OK button:
Let me translate from my German UI:
The file was exported, but following problems did happen:
Missing Ressources: 2
If you inspect the file paths of the error message, you can see, that InDesign internally is thinking, that the CSS and the JS files should (also?) be present inside the app?
Huh? Let's check the file paths again in both screens above. There is no indication, that the files are missing or misplaced or something.
And that could mean, that if you are working with external CSS and JS files from the UI only, InDesign would duplicate these files also to the app? Temporarily? Don't know.
Hm. What could it be else?
Let's check the UI way.
Let's remove the file paths from the UI and do it without a script.
That went through without a problem. The exported EPUP contains the external CSS and JS files.
I marked the files in yellow here:
So we have a problem here. A bug?
I have no definite answer yet…
Ok. I found a difference from the representation of the file paths, the one from scripting and the one from the UI.
From my examples:
/InDesign CC-2014.1 EPubFixedLayoutExport/external.css
With assigning the file through the UI:
MB-2:InDesign CC-2014.1 EPubFixedLayoutExport:external.css
See the difference in notation. And also the name of my Mac at the beginning?
Just replace all "/" with ":" when on a Mac and add the name of the device to the beginning of the string.
I just tested this and it worked.
Now the question is:
How can we get the name of the disk where the CSS and JS files are saved by ExtendScript?
I searched a bit in the Adobe Scripting Forum and came to the conclusion, that with pure ExtendScript there is no way!
Fortunately Kasyan Servetsky came to rescue here. In an old thread from 2009 he used an AppleScript inside an ExtendScript to solve that problem.
It's not a general solution, but a solution that could fit into your project.
Kasyan's solution is working for me, because:
1. My InDesign app is installed on the startup disk
2. My CSS and JS files are saved on the startup disk
Here a link to the discussion back then.
Also see Kasyan's solution in answer #5.
And here a minor enhancement on my side to get the name of the InDesign app in a more general way than before:
And for all the lurkers:
Representing the file path in OSX of an external file object in the EPUB export window with ":" and the the disk name is really "ancient"; it goes back to OS8, OS9, I think. Adobe should change that as soon as possible. The 90s are over; OS9 was launched in October 1999. Since InDesign CC 2014.1 is "de-carbonized" *, I wonder why this notation is there at all.
Or enhance ExtendScript with a decent method to read out the name of a disk.
Thank you for your thorough response.
Ok... have submitted a bug report pointing to this thread & will ask designers to set paths manually on export for now.
May investigate further based on your great write-up... our files are located on a NAS (which probably doesn't make a difference) but who knows.
You have to investigate a bit time in AppleScript to get a working solution, I think.
What is the protocol of the connection to the NAS?
A starting point could be this documentation:
It's from 2013, maybe a newer one is in place right now…
Just tried with a basic replace :
var str = wp.replace(/\//g, ":");
And it works great from the NAS. Thank you so much for your help - i was tearing my hair out
Then I hope, that none of your files or folder names have a "/" inside. ;-)
@boom-shanka – Just replacing the "/" with ":" did not work in my case. Just tested that.
I really had to add the name of the volume to the beginning of the path string.
And I think, after doing the export to EPUB by script, we should remove the export path to reset the document's preferences to its inital state.
This can be done by applying an empty array.
Hm. Don't you think my answer #2 here would be more appropriate to mark as "Answered" ?
And I will take back my little rant from answer #4 here. At least a bit.
About the representation of the file path with ":" as dividers for subfolders.
If you come accross a file path that includes "/" in its names, you are good with the current implementation of the file path with the ":" dividers.
The external CSS and JS files will be included. No error about the file path will be thrown.