Copy link to clipboard
Copied
Hi everybody,
I have an issue with a rather big script.
Here is what the script does:
The script works fine until there is more than one FM instance running it, i.e, until I use FrameMaker Publishing Server 2015, which runs a few FM instances simultaneously.
Here is what goes wrong:
Result: the books have the wrong titles pages, sometimes also the wrong footer and colors.
The script is ExtendScript and does not contain any app.ActiveDoc.
During the run, files are generated under \AppData\Local\Temp, could the mix occur due to a dissociation issue with those files?
Copy link to clipboard
Copied
I think your intuition about multiple instances overwriting each other's files is the right explanation for this.
Your script should probably create a new temp folder to store its files, then remove that temp folder when it is done. Use a timestamp as the name for the temp subfolder - that ensures that your multiple FM instances are not overwriting each other's files.
Good luck
4everJang
Copy link to clipboard
Copied
Thank you for the tip.
The script applies an xslt. Since I didn't write the template (13pages!) and I'm not comfortable with xslt, I didn't manage to create a separate tempfolder for each ditamap.
My workaround in ExtendScript is to make other instances wait until the transformation is done. Looks a bit like this:
var FrameMakerLock=new File("D:\\FrameMakerLock.txt");
while(FrameMakerLock.exists) {
$.sleep (5000);
if(FrameMakerLock.exists) {
FrameMakerLock.open('r');
var content = FrameMakerLock.read()
var olddate = new Date(content.split("\n")[0]);
var datediff = (new Date() - olddate)/60000; //datediff in minutes
FrameMakerLock.close();
if (datediff > 20) FrameMakerLock.remove(); //remove the lock because it was created over 20 minutes ago
}
}
//create the lock then start Publish
FrameMakerLock.open('w');
//write a date in the lockfile
//so other instances can check the age
FrameMakerLock.writeln(new Date().toUTCString());
FrameMakerLock.close();
//start the xslt
TheFunctionThatAppliesXSLT(DitamapFile);
//remove the lock
FrameMakerLock.remove();
Regards