Copy link to clipboard
Copied
I have a script to generate HTML below. This works, however some documents create the "Paragraph tag ... is not in the Paragraph Catalog" dialog. I need the script to not require any input, so how can this be suppressed, or push all items into the catalog before saving?
Also I haven't seen it yet, but suspect similar issues could occur with tables and characters not in the catalog.
Alternatively, something that can intercept dialogs and hit "ok" would work.
Thanks
function saveCsrHTML(doc, suffix) {
var saveDirname = doc.Name.substr(0, doc.Name.lastIndexOf("\\"));
var saveBasename = basename(doc.Name);
var params = GetSaveDefaultParams();
var i = GetPropIndex(params, Constants.FS_FileType);
params.propVal.ival = Constants.FV_SaveFmtFilter;
var i = GetPropIndex(params, Constants.FS_SaveFileTypeHint);
params.propVal.sval ="0001ADBEHTML";
var i = GetPropIndex (params, Constants.FS_SaveMode);
params.propVal.ival = Constants.FV_ModeSaveAs;
var i = GetPropIndex (params, Constants.FS_RetainNameStripe);
params.propVal.ival = 0;
var i = GetPropIndex(params, Constants.FS_AlertUserAboutFailure);
params.propVal.ival = false;
var returnParamsp = new PropVals();
var filename = saveDirname + "\\" + saveBasename + suffix + ".html";
doc.Save(filename, params, returnParamsp);
}
Copy link to clipboard
Copied
Hi,
Please visit the following blog for information to suppress a particular FM alert:
Regards,
Saurabh
Copy link to clipboard
Copied
There are tools (Plug-ins and ExtendScripts) for FrameMaker 5 - 10 available to delete unused, all ... (free)
and rename formats (e.g. not in Catalog) to other.
- Georg
Copy link to clipboard
Copied
> Please visit the following blog for information to suppress a particular FM alert:
I saw that, but this message includes the paragraph name, and that posting says the message must match exactly. Perhaps framemaker 11 could accept "*" wildcards?
>There are tools (Plug-ins and ExtendScripts) for FrameMaker 5 - 10 available to delete unused, all ... (free)
>and rename formats (e.g. not in Catalog) to other.
Can you point to one?
Copy link to clipboard
Copied
Hi,
You can use regular expressions in ExtendScript to make it work for a particular pattern.
Regards,
Saurabh
Copy link to clipboard
Copied
Thanks for sticking with me!
>You can use regular expressions in ExtendScript to make it work for a particular pattern.
That logically makes sense, however when I run the whole thing below as a script the callback is never activated. But, if I then manually File->Save As->HTML it works correctly. What am I missing?
alert("Loading script");
Notification(Constants.FA_Note_Alert,true); //Registering for the event FA_Note_Alert
saveHTML(app.ActiveDoc, "foobar.html");
function Notify(note,doc,sparm,iparm) {
switch (note) {
case Constants.FA_Note_Alert :
alert("notify callback "+sparm);
if (/Paragraph tag .* is not in the Paragraph Catalog.*/i.test(sparm)) {
ReturnValue(Constants.FR_YesOperation)
}
break;
}
}
function saveHTML(doc, filename) {
var params = GetSaveDefaultParams();
var i = GetPropIndex(params, Constants.FS_FileType);
params.propVal.ival = Constants.FV_SaveFmtFilter;
var i = GetPropIndex(params, Constants.FS_SaveFileTypeHint);
params.propVal.sval ="0001ADBEHTML";
var i = GetPropIndex (params, Constants.FS_SaveMode);
params.propVal.ival = Constants.FV_ModeSaveAs;
var i = GetPropIndex (params, Constants.FS_RetainNameStripe);
params.propVal.ival = 0;
var i = GetPropIndex(params, Constants.FS_AlertUserAboutFailure);
params.propVal.ival = false;
var returnParamsp = new PropVals();
Err("Saving HTML "+filename+"...\n");
doc.Save(filename, params, returnParamsp);
}
Copy link to clipboard
Copied
Hi,
Do you see any errors in the FM console window?
Regards,
Saurabh
Copy link to clipboard
Copied
The framemaker console has the print messages my script makes:
Saving HTML R:\....html...
The javascipt console in the debug window is empty.
I get the "loading script" alert, but not the "notify callback" alert.
After running the above, without reloading the script, the manual "Save As" works and I get the notify callback. So obviously it is being installed the first time, just not called. If I run the script a second time in the same session it still doesn't work, so it's not a matter of it being installed too late or something like that.