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 ();