Skip to main content
Arnis Gubins
Inspiring
February 4, 2015
Answered

How to access the Publisher module

  • February 4, 2015
  • 4 replies
  • 2569 views

Does anybody know if the Publisher module is exposed to FM's Extendscript (or FDK)? I looked through all of the scripting info and the FDK info, .h and config files and couldn't find any references to it other than the TPUBforFMDoc (Book/DITA  esc ph shortcut) command. I need to kick off the Publish module after some manipulation and use a specified STS file depending upon the manipulation.

This topic has been closed for replies.
Correct answer Arnis Gubins

Thanks to the Adobe engineering team in India, here's a sample script showing how to call the FMPublisher client using a pre-defined STS file in order to generate one of Responsive HTML5, WebHelp, ePub, Kindle or CHM outputs:

/***************************************************************************************** Function to set STS *************************************************************************

Input1:- Path of sts to be set  (if path contains backward slashes, each slash character should be masked with another backward slash)

e.g. stsPath = C:\\Users\\username\\Desktop\\settings.sts*/

function SetSts(stsPath)

{

    var strCommand="SetMCPSetting "+ stsPath ;

   

  var ret=CallClient ("FMPublisher", strCommand );

    return ret;

}

/***************************************************************************************** Function to set BASE OUTPUT LOCATION of the publish outcome *************************************************************************

Input1:- Base Output Path to be set  (if path contains backward slashes, each slash character should be masked with another backward slash)                       */

function SetBaseOutputLocation(outputPath)

{

    var strCommand="SetOutputLocation "+ outputPath ;

   

  var ret=CallClient ("FMPublisher", strCommand );

    return ret;

}

/*********************************************************************** Function to Publish *******************************************************************************

Input1:- Base Output Path to be set  (Output parameter is one of these values: Responsive HTML5, WebHelp, EPub, Kindle, Microsoft HTML Help)       */

function PublishOutput(output)

{

   

    strCommand="MCPPublish "+output ;

    var ret=CallClient ("FMPublisher", strCommand);

    return ret;

}

function doGenerateOutput()

{

    var stsPath = "C:\\Users\\username\\Desktop\\Settings.sts";

    var outputPath = "C:\\Users\\username\\Desktop\\Output";

    var output = "Responsive HTML5";

    SetSts (stsPath);

    SetBaseOutputLocation (outputPath);

    PublishOutput (output);

}

doGenerateOutput ();

4 replies

hadih26673991
Inspiring
August 24, 2020

Thanks for sharing this. I still wonder how you define the Source Document and the Ditaval. Could you please comment on that as well?

frameexpert
Community Expert
Community Expert
March 8, 2018

Is there a way to set the input file or book using the CallClient ("FMPublisher") function? Thanks.

www.frameexpert.com
frameexpert
Community Expert
Community Expert
February 12, 2015

Hi Arnis, Excellent! Thanks for posting this. Have you had a chance to test it? Thanks. -Rick

www.frameexpert.com
Participating Frequently
February 5, 2015

It might expose an interface to F_ApiCallClient(). But there is nothing documented in the "Calling Clients" chapter of the FDK Reference Guide, And I don't believe there's any easy way even to determine whether it is using this mechanism, let alone to capture or reverse-engineer any commands being used. So I guess this is a non-starter..

Another possibility is a scripted playback of keyboard shortcuts.

Arnis Gubins
Inspiring
February 5, 2015

Thanks for looking into this Mike. I'm pretty certain that it's a client call to the FMPublisher.dll, but what message is required and what return codes are generated is the mystery. I guess the powers that be are afraid that someone will start cloning the FMServer functionality and impact their (perceived) revenue stream. I also note that the latest FrameScript version also has nothing about accessing the Publish routines.

The keystroke scripting is a good idea, but on further thought wouldn't work that well, as different STS files and output locales would need to be used depending upon prior outcomes, so pre-configuring all of the possible combinations would be a wee bit of a maintenance challenge and would be installation dependent.

Arnis Gubins
Arnis GubinsAuthorCorrect answer
Inspiring
February 12, 2015

Thanks to the Adobe engineering team in India, here's a sample script showing how to call the FMPublisher client using a pre-defined STS file in order to generate one of Responsive HTML5, WebHelp, ePub, Kindle or CHM outputs:

/***************************************************************************************** Function to set STS *************************************************************************

Input1:- Path of sts to be set  (if path contains backward slashes, each slash character should be masked with another backward slash)

e.g. stsPath = C:\\Users\\username\\Desktop\\settings.sts*/

function SetSts(stsPath)

{

    var strCommand="SetMCPSetting "+ stsPath ;

   

  var ret=CallClient ("FMPublisher", strCommand );

    return ret;

}

/***************************************************************************************** Function to set BASE OUTPUT LOCATION of the publish outcome *************************************************************************

Input1:- Base Output Path to be set  (if path contains backward slashes, each slash character should be masked with another backward slash)                       */

function SetBaseOutputLocation(outputPath)

{

    var strCommand="SetOutputLocation "+ outputPath ;

   

  var ret=CallClient ("FMPublisher", strCommand );

    return ret;

}

/*********************************************************************** Function to Publish *******************************************************************************

Input1:- Base Output Path to be set  (Output parameter is one of these values: Responsive HTML5, WebHelp, EPub, Kindle, Microsoft HTML Help)       */

function PublishOutput(output)

{

   

    strCommand="MCPPublish "+output ;

    var ret=CallClient ("FMPublisher", strCommand);

    return ret;

}

function doGenerateOutput()

{

    var stsPath = "C:\\Users\\username\\Desktop\\Settings.sts";

    var outputPath = "C:\\Users\\username\\Desktop\\Output";

    var output = "Responsive HTML5";

    SetSts (stsPath);

    SetBaseOutputLocation (outputPath);

    PublishOutput (output);

}

doGenerateOutput ();