• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Same script simultaneously on two FM session/instances

Explorer ,
Apr 28, 2017 Apr 28, 2017

Copy link to clipboard

Copied

Hi everybody,

I have an issue with a rather big script.

Here is what the script does:

  1. it runs over a *.ditamap and rearranges the many *.xml files into a few *.fm files for a new *.book
  2. a specific titlepage.fm is added into the *.book
  3. TOC and index are generated and included as well
  4. formats and definitions are imported from a specific variable.fm into to book.

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:

  1. FM instance 'a' imports titlepage.fm from any other FM instance running
  2. the import is not applied on every *.fm file of the book.

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?

TOPICS
Scripting

Views

272

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 28, 2017 Apr 28, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2017 Jun 16, 2017

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines