Copy link to clipboard
Copied
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.
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 sh
...Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 ();
Copy link to clipboard
Copied
Hi Arnis,
I haven't been about to get this to work and wonder if I am missing a parameter or something: Here is my code with FrameMaker 12 and ExtendScript:
#target "framemaker-12.0"
var stsFile = "C:\\Program Files (x86)\\Adobe\\AdobeFrameMaker12\\fminit\\Publisher\\Default.sts";
var folder = "C:\\DATA\\Scripts\\HTML5";
var output = "Responsive HTML5";
// Set the sts path.
setSts (stsFile);
setOutputFolder (folder);
publishOutput (output);
function setSts (stsFile) {
var cmd = "SetMCPSetting " + stsFile;
alert (cmd);
return CallClient ("FMPublisher", cmd);
}
function setOutputFolder (folder) {
var cmd = "SetOutputLocation " + folder;
alert (cmd);
return CallClient ("FMPublisher", cmd);
}
function publishOutput (output) {
var cmd = "MCPPublish " + output;
alert (cmd);
return CallClient ("FMPublisher", cmd);
}
All the paths and files are correct, but I don't get any progress bars or output. Any help would be appreciated. Thanks.
Rick
Copy link to clipboard
Copied
It actually IS working. I had the output path wrong. I am sorry for the confusion. You may mind my code a little more concise than Adobe's. Make sure you remove the alert statements before using it. Thanks.
Copy link to clipboard
Copied
Hi,
very good helpful script.
Are there hints for further commands? I would like to select the dita file to be published (via script). In the list of the pod you always have all open files, which could be manually selected.
However, I only found the additional command SetDitaval. SetFilePointer I also could see.
Does anyone have an idea.
Thank you
Apollo102
Copy link to clipboard
Copied
Hi Arnis, Excellent! Thanks for posting this. Have you had a chance to test it? Thanks. -Rick
Copy link to clipboard
Copied
Is there a way to set the input file or book using the CallClient ("FMPublisher") function? Thanks.
Copy link to clipboard
Copied
Thanks for sharing this. I still wonder how you define the Source Document and the Ditaval. Could you please comment on that as well?