Skip to main content
Known Participant
October 5, 2020
Question

ExtendScript Equivalent of the FrameMaker Command File > Publish > Basic HTML

  • October 5, 2020
  • 1 reply
  • 386 views

Hello,

 

I am looking for an ExtendScript equivalent of the FrameMaker command File > Publish > Basic HTML.

 

Specifically, I would like to see how the command identifies and assigns filenames to the graphics. For example, inset_0.jpg, inset_1.jpg, and <filename>001.jpg.

 

I need to write an ExtendScript that exports the graphics from a FrameMaker file, and I would like that script to use the same logic that the File > Publish > Basic HTML command uses so that the graphic filenames are named in the same way.

 

Take care,

 

Jason

This topic has been closed for replies.

1 reply

frameexpert
Community Expert
Community Expert
October 5, 2020

Here is some code you can use to figure it out. I like to do things with functions, although having a separate function for each call in this case may not be necessary. But it will get you started.

 

#target framemaker
  
var stsFile = "C:\\Program Files (x86)\\Adobe\\AdobeFrameMaker12\\fminit\\Publisher\\Default.sts";  
var input = "C:\\DATA\\Scripts\\DeleteMe2.fm";
var folder = "C:\\DATA\\Scripts\\HTML5";  
var output = "Responsive HTML5";  
  
// Set the sts path.  
setSts (stsFile); 
setInputFile (input);
setOutputFolder (folder);  
publishOutput (output);  
  
function setSts (stsFile) {  
      
    var cmd = "SetMCPSetting " + stsFile;  
    alert (cmd);  
    return CallClient ("FMPublisher", cmd);  
}  
  
function setInputFile (file) {  
      
    var cmd = "SetInputFile " + file;  
    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);  
}     
frameexpert
Community Expert
Community Expert
October 5, 2020

Note that the alerts in each function are just for debugging purposes and you will have to take them out.

Jason L-SAuthor
Known Participant
October 15, 2020

Thanks for the reply.

 

I ran your example, and I understand what it does by calling the Publish HTML5 command. That's pretty neat, BTW. I didn't know you could use CallClient with variables like that. It's sort of like FCodes, only much better 🙂

 

This is not exactly what I am looking for, however. I was asking if there is a way to understand the underlying code for the Publish > Basic HTML command in order to see how the command identifies and names the graphic files in its output. I have an ExtendScript that extracts the graphics from a file and converts them all to PDF format. I want my ExtendScript to function exacly  like the Publish > Basic HTML command in terms of extracting the graphics. The goal is to use both commands together so that I can run Publish > Basic HTML, but then replace graphic files in the assets folder that is created from the Publish > Basic HTML command. The graphic filenames do not match.

 

For example, the Publish > Basic HTML command produces the following files in the assets folder:  inset_0.jpg, inset_1.jpg, inset_2.jpg, overview0005.jpg.

 

My ExtendScript produces the following files: overview-graphic0.pdf, overview-graphic1.pdf, overview-graphic2.pdf, overview-graphic3.pdf.

 

So I either need to change my ExtendScript to fix the filenames in exactly the same way the Publish > Basic HTML does, or I need to customize the Publish > Basic HTML command to convert the graphics to PDF instead of JPG.

 

Do you have any suggestions? I was thinking that I might contact an Adobe developer for help with this to understand how the Publish > Basic HTML command handles graphics and see if there is a way to replicate that part of the command as an ExtendScript.

 

Thanks.