Copy link to clipboard
Copied
FM 12 all patched up, Windows 8.1.
I have a book with about 30 FMs. When I Save book as HTML, I end up with one HTM file. I want the same number of HTM files as FMs. What am I missing.
Note, I expect each FM to produce an HTM, but that doesn't happen. I have the reference page HTML table set to create a new page on Heading1, and I use Heading1 as the first heading in each FM.
Thoughts?
Sean
Hi Sean,
Here is a script that will save each document in the active book as an .htm file. To use it, copy it to an empty text file and save it with a .jsx extension. Then open your book and choose File > Script > Run and choose the script. Please let me know if you have any questions or comments.
-Rick
...#target framemaker
main ();
function main () {
var book;
book = app.ActiveBook;
if (book.ObjectValid () === 1) {
processBook (book);
}
else {
alert (
Copy link to clipboard
Copied
Think you need to publish the FM book as WebHelp & set the pagination to whatever splits you want to see topics created for
Copy link to clipboard
Copied
I was thinking the same – as you have FM12, why do you go this old route anyway and don't just use the publish pod?
Copy link to clipboard
Copied
That is unfortunate.
I don't use the publish options because I need DHTML with non of the accouterments of the other help "systems." I don't need and can't use extra directory structure, JS files, etc. I just need HTML files, graphics, and one CSS. These basic HTML files are used by manufacturing equipment with screen and browser restrictions.
RoboHelp is even worse and adds even more baggage. I have found ePublisher does exactly what I need, but it's 750/year more than my budget.
So, I figured setting new page to Y would give me a new page. Silly me. Thanks for the help though!!
Cheers,
Sean
Copy link to clipboard
Copied
Speculatively, after considering a WebHelp set output from DITA by another engine … one pass through the output with a text editor could remove all the js headers (which you don't need) and the graphics paths to give you a flat file structure. Much would depend on how much other cruft was left in, of course. Speculatively …
Copy link to clipboard
Copied
Why not just use the freebie MIF2Go product? I think plain HTML was one of its outputs IIRC.
Copy link to clipboard
Copied
I have never been able to get MIF2Go to work. I might try it again. Thanks.
Copy link to clipboard
Copied
FWIW, I tried installing Mif2Go again. It is in the file menu, but when I try to save XHTML, I repeatedly get prompted that the ini file is missing and do I want to set up Mif2Go. This loop just repeats. Interestingly, there is a mif2go.ini file that is created in the same directory as the fm file I am trying to convert.
So, maybe it's just no good for FM12.
Copy link to clipboard
Copied
Seem to remember reading that there’s a patch from mif2go that fixes FM12.
Copy link to clipboard
Copied
I found that and one for XHTML output. It's better, but no luck. I now get a log file, history file, ini file, and prj file, and the message says thex html file was created. But no xhtml file is actually created.
Copy link to clipboard
Copied
Hi Sean,
Here is a script that will save each document in the active book as an .htm file. To use it, copy it to an empty text file and save it with a .jsx extension. Then open your book and choose File > Script > Run and choose the script. Please let me know if you have any questions or comments.
-Rick
#target framemaker
main ();
function main () {
var book;
book = app.ActiveBook;
if (book.ObjectValid () === 1) {
processBook (book);
}
else {
alert ("There is no active book.", "www.frameexpert.com");
}
}
function saveAsHtml (doc) {
var params, returnParams, saveName, i;
saveName = doc.Name.replace (/\.[^\.]+$/, ".htm");
params = GetSaveDefaultParams ();
returnParams = new PropVals ();
i = GetPropIndex (params, Constants.FS_FileType);
params.propVal.ival = Constants.FV_SaveFmtFilter;
i = GetPropIndex (params, Constants.FS_SaveFileTypeHint);
params.propVal.sval = "0001ADBEHTML ";
doc.Save (saveName, params, returnParams);
}
function processBook (book) {
var bookComp = 0, doc = 0;
// Loop through all of the components in the book.
bookComp = book.FirstComponentInBook;
while (bookComp.ObjectValid ()) {
// Get the document returned in a JavaScript object.
doc = getDocument (bookComp.Name);
if (doc) {
book.StatusLine = "Processing " + File(bookComp.Name).displayName;
// Call the function to process the document.
saveAsHtml (doc);
// If the document was opened by the script, close it.
if (doc.openedByScript === true) {
doc.Close (true);
}
}
bookComp = bookComp.NextBookComponentInDFSOrder;
}
// Reset the book status line.
book.StatusLine = "";
}
function getDocument (filename) {
// See if the document is already open.
var doc = docIsOpen (filename);
if (doc) {
return doc;
} else {
// The document is not already open, so open it.
return openDocOrBook (filename, undefined, false);
}
}
function docIsOpen (filename) {
// Make a File object from the file name.
var file = File (filename);
// Uppercase the filename for easy comparison.
var name = file.fullName.toUpperCase ();
// Loop through the open documents in the session.
var doc = app.FirstOpenDoc;
while (doc.ObjectValid () === 1) {
// Compare the document’s name with the one we are looking for.
if (File (doc.Name).fullName.toUpperCase () === name) {
// The document we are looking for is open.
doc.openedByScript = false;
return doc;
}
doc = doc.NextOpenDocInSession;
}
}
function openDocOrBook (filename, structuredApplication, visible) {
var i = 0, docOrBook = 0;
// Get default property list for opening documents.
var openProps = GetOpenDefaultParams ();
// Get a property list to return any error messages.
var retParm = new PropVals ();
// Set specific open property values to open the document.
i=GetPropIndex (openProps,Constants.FS_AlertUserAboutFailure);
openProps.propVal.ival=false;
i=GetPropIndex (openProps,Constants.FS_MakeVisible);
openProps.propVal.ival=visible;
i=GetPropIndex (openProps,Constants.FS_FileIsOldVersion);
openProps.propVal.ival=Constants.FV_DoOK;
i=GetPropIndex (openProps,Constants.FS_FileIsInUse);
openProps.propVal.ival=Constants.FV_ResetLockAndContinue;
i=GetPropIndex (openProps,Constants.FS_FontChangedMetric);
openProps.propVal.ival=Constants.FV_DoOK;
i=GetPropIndex (openProps,Constants.FS_FontNotFoundInCatalog);
openProps.propVal.ival=Constants.FV_DoOK;
i=GetPropIndex (openProps,Constants.FS_FontNotFoundInDoc);
openProps.propVal.ival=Constants.FV_DoOK;
i=GetPropIndex (openProps,Constants.FS_RefFileNotFound);
openProps.propVal.ival=Constants.FV_AllowAllRefFilesUnFindable;
if (structuredApplication !== undefined) {
i=GetPropIndex (openProps,Constants.FS_StructuredOpenApplication);
openProps.propVal.sval=structuredApplication;
}
// Attempt to open the document.
docOrBook = Open (filename,openProps,retParm);
if (docOrBook.ObjectValid () === 1) {
// Add a property to the document or book, indicating that the script opened it.
docOrBook.openedByScript = true;
}
else {
// If the document can't be open, print the errors to the Console.
PrintOpenStatus (retParm);
}
return docOrBook; // Return the document or book object.
}
Copy link to clipboard
Copied
Thank you very much for this and all your continued FrameMaker help over the years!
Sean
Copy link to clipboard
Copied
My pleasure. Please mark my answer as correct when you get a chance. Thanks. -Rick