Block Messages From Framemaker

New Here ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

I have developed a script that converts ditamaps into framemaker books.  Due to the size and number of books to be created this script must run overnight.  Seemingly randomly framemaker creates a popup message that warns me it doesn't know where referenced images files are located and that the images will appear as grey boxes.  This popup prevents the script from running until someone clicks the "ok" button, at which point it will resume.  Is there a way to prevent framemaker from generating these popups?

TOPICS
Scripting

Views

4.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

When your script is opening files, you are using the Open method with a set of open parameters. There are various parameters that tell FrameMaker not to resolve references, not to complain about missing fonts etc. You shoud make sure all those options are set such that nothing can stop your process. Use the FDK Reference Guide - look for GetOpenDefaultParams( ) - to find the full list. I have copied the ones that may cause unwanted blocking messages. I am just naming the param ident names and the values to set. You know how to handle an array of PropVals (otherwise you would not have your script open files at all).

FS_FileIsOldVersion -> FV_DoOK

FS_FontChangedMetric -> FV_DoOK

FS_FontNotFoundInCatalog -> FV_DoOK

FS_FontNotFoundInDoc -> FV_DoOK

FS_LanguageNotAvailable -> FV_DoOK

FS_LockCantBeReset -> FV_DoOK

FS_RefFileNotFound -> FV_AllowAllFilesUnFindable

FS_UpdateXRefs  -> FV_DoNo (this could make your process a LOT faster, and I am guessing your XRefs will either have to be re-created or updated by your script, or remain as they are).

I hope this helps.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

function openXmlFile(filePath) { 

    var file = File(filePath);

    var fileName = file.fsName;

    var openParams, i;

    openParams =  GetOpenDefaultParams();

   

   

   i = GetPropIndex(openParams, Constants.FS_RefFileNotFound);

    openParams.propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;       

    i = GetPropIndex(openParams, Constants.FS_FileIsOldVersion);

    openParams.propVal.ival = Constants.FV_DoOK;

    i = GetPropIndex(openParams, Constants.FS_FontChangedMetric);

    openParams.propVal.ival = Constants.FV_DoOK;  

    i = GetPropIndex(openParams, Constants.FS_FontNotFoundInCatalog);

    openParams.propVal.ival = Constants.FV_DoOK;   

    i = GetPropIndex(openParams, Constants.FS_FontNotFoundInDoc);

    openParams.propVal.ival = Constants.FV_DoOK;   

    i = GetPropIndex(openParams, Constants.FS_LockCantBeReset);

    openParams.propVal.ival = Constants.FV_DoOK;       

    i = GetPropIndex(openParams, Constants.FS_FileIsInUse);

    openParams.propVal.ival = Constants.FV_OpenViewOnly;     

    i = GetPropIndex(openParams, Constants.FS_UpdateXRefs);

    openParams.propVal.ival = Constants.FV_DoNo; 

   

   

    var retParams = new PropVals();

    var doc = Open(fileName, openParams, retParams);

    return doc; 

}

This is my current file opening function updated with your suggested open params.  However I'm still randomly getting this error message:

error.PNG

Is there anyway to block user interaction entirely in extendscript like I can when writing scripts for Adobe Illustrator?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

Yes, this message is very annoying and there is no way to suppress it as far as I know. What are you doing after you open the files? You can open a file invisibly so it doesn't display on screen and still work on it programmatically. That would prevent that message from appearing.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

I'm opening a diatamap, converting it to a framemaker book, and inserting some boilerplate .fm files into the book, and saving the book to a network location.  The goal is to run the script overnight so opening the file invisibly is fine.  How do I do that?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

i=GetPropIndex(openParams,Constants.FS_MakeVisible);

openParams.propVal.ival=false;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

Using this param,

    i=GetPropIndex(openParams,Constants.FS_MakeVisible);

    openParams.propVal.ival=false;

keeps the ditamap invisible which is nice, but the error does not occur on opening the ditamap.  It occurs on saving it as a book, as seen in the screenshot I posted earlier.  Even when the ditamap is invisible the book is not and this is where the error message pops up.

This is my save to framemaker book function:

function saveToFm(fileObject, savePath, ditaValFile) { 

    var saveParams, i;

    saveParams= GetSaveDefaultParams(); 

   

    i = GetPropIndex(saveParams, Constants.FS_FileType); 

    saveParams.propVal.ival = Constants.FV_SaveFmtBookWithFm;

    i = GetPropIndex(saveParams, Constants.FS_DitavalFile); 

    saveParams.propVal.sval =  "file path to ditaval goes here" + ditaValFile;

   

    var saveAsName = savePath; 

    var returnParamsp = new PropVals(); 

    fileObject.Save(saveAsName, saveParams, returnParamsp); 

I tired using the same FS_MakeVisible parameter as a save parameter but that didn't work.  Is there a parameter I can use in this function so the save process is invisible?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

Hi gabeS1234,

have you tried "FS_AlertUserAboutFailure" as I suggested above?

It also works when saving a file.

You should check/change  ALL of your save params.

Take a look at the FDK-Programmers reference -> FDK Function Reference -> F_ApiGetSaveDefaultParams.

As frameexpert always recommends, develop the script step by step. Re: Framemaker script

Your questions are pretty messed up, so it is not so easy for the supporters here to follow your thoughts.

So: could you manage to open a file siltenly without any error?

Please make it a bit clearer for us.

Klaus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

The MakeVIsible parameter is only for opening files - it determines whether your document is opened without being shown on the screen. It has no meaning for saving.

Your problem is NOT caused by visibility of the documents - it is blocking on something else that you need to fix. Als Klaus suggested, you reaslly need to read the info in the FDK Reference Guide and do small tests, one step at a time.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

This is not something that can be fixed programmatically. Adobe needs to fix this. I have been complaining about this dialog for years. You won't find anything in the FDK Reference Guide that will address this.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

The original poster's problem is pretty straightforward: the "Cannot display some imported graphics..." dialog box pops up and stops his script. It has nothing to do with how he is opening or saving files. This dialog box pops up at least once per session when FrameMaker displays a page that has a missing graphic. There needs to be a way to suppress this message, but there isn't.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

If this is the case and the fact that I can't suppress this message is fundamentally a bug, is there at least a way I can detect the presence  of this popup so my script can either directly click the "OK" button or press enter?  If not I'll have to resort to the extremely hacky solution of having my script press enter every 30 seconds, and I really don't want to do that.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

I don't think your script can press Enter at all. When it executes a function in the FM target, the script does not have the focus, hence it cannot do anything until FM hands back control to the engine that runs the script.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

Sorry Rick, but I do not believe that this is true. I constructed a small test file that has an imported graphic, created a script that opens, saves and closes it, ran it succesfully, then renamed the graphic and ran the script again. No dialog, just a grey box to show the missing image. This means that even with the document opened visibly there is no dialog blocking the script.

I do see one open parameter that I am using and that is missing from the list of parameters used by gabeS1234:

i = GetPropIndex( oaOpenProps, Constants.FS_DontNotifyAPIClients );
oaOpenProps.propVal.ival = true;

My guess is that this will solve the problem once and for all. Gabe, let is know if this solved the issue.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

I'm dealing with a whole book from a customer where I don't have the pictures.

And like Jang I never get this message.

So it cannot be a bug.

gabeS1234​ : I still don't know at which point the message appears. When opening or saving the file (debugging step by step F11)?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

I am sorry to disagree with you guys, but the proof is in the original poster's screenshot. I still get this message periodically in every version of FrameMaker that I have worked with, including FrameMaker 2019.

Klaus, it is not a bug; it is strictly an annoying (and in my opinion, unnecessary) information message. The message usually appears in a FrameMaker session the very first time when a page appears on the screen where there is a missing graphic.

gabe, you can't use ExtendScript to press buttons to dismiss the dialog box. There are some third-party Windows tools like PTFB that will automatically dismiss dialog boxes when they appear. You can specify which dialog boxes should be dismissed.

To summarize: We have all given gabe some useful information to make his script better, but unfortunately, they do not address his fundamental issue.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

The message appears during the final step of saving the files.  Each chapter is generated and saved to my specified location as a .fm file without incident.  The problem happens when Framemaker creates the .book file.  What makes it near impossible to debug is that the message appears randomly.  So when running the script on the exact same source file set it may appear on generation of the 5th .book file or the 30th.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

The parameter DontNotifyAPIClients was NOT in the original script. It can also be used when saving files.

Also, there is a bunch of alerts in the FrameMaker preferences that may cause alerts. But I really want to hear back whether the APIClients notification is the one that makes the dialogs appear.

Gabe ? Any progress ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

One more time guys: this doesn't have anything to do with gabe's code. Here is what I did to get the dialog box below (about 5 minutes ago).

1) Create a blank, Portrait document.

2) Insert an image.

3) Save the document and quit FrameMaker.

4) Rename the image on disk to break the link.

5) Launch FrameMaker and open the file, ignoring all missing files.

As soon as the page displays, the dialog box pops up. I am using the latest build of FrameMaker 2019 64-bit.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

Yes, and I am telling you that i do NOT get that dialog with my script. You can test it on your system if you want - here is the full code. I am setting three parameters that may affect the behaviour:

DontNotifyAPIClients - as I have no control over their error handling and I do not need their functionality here.

MakeVisible - when I make the file visible on screen, the message will pop up as FM tries to render the graphic and cannot

AlertUserAboutFailure - just in case FM would want to say anything at all via dialogs.

The combination of the above parameters shuts FM up and allows my script to run without any user interaction.

var oDoc = SiD_OpenDoc( sFileName, "invisible silent" );

oDoc.SimpleSave( oDoc.Name, false );

oDoc.Close( 1 );

function SiD_OpenDoc( sFilename, sOptions )

{

  /*  Ths function opens a document.

  The options string allows opening files invisible and/or read-only. */

  var oaOpenProps = GetOpenDefaultParams( );

    if( sOptions != null && sOptions.match( "invisible" ) )

    {

        i = GetPropIndex( oaOpenProps, Constants.FS_MakeVisible );

        oaOpenProps.propVal.ival = Constants.FV_DoCancel;

    }

    if( sOptions != null && sOptions.match( "fm" ) )

    {

  i = GetPropIndex( oaOpenProps, Constants.FS_DisallowFilterTypes );

  oaOpenProps.propVal.ival = true;

  i = GetPropIndex( oaOpenProps, Constants.FS_DisallowPlainText );

  oaOpenProps.propVal.ival = true;

  }

  i = GetPropIndex( oaOpenProps, Constants.FS_DontNotifyAPIClients );

  oaOpenProps.propVal.ival = true;

  i = GetPropIndex( oaOpenProps, Constants.FS_FileIsOldVersion );

  oaOpenProps.propVal.ival = Constants.FV_DoOK;

  i = GetPropIndex( oaOpenProps, Constants.FS_FontNotFoundInCatalog );

  oaOpenProps.propVal.ival = Constants.FV_DoOK;

  i = GetPropIndex( oaOpenProps, Constants.FS_FontNotFoundInDoc );

  oaOpenProps.propVal.ival = Constants.FV_DoOK;

  i = GetPropIndex( oaOpenProps, Constants.FS_RefFileNotFound );

  oaOpenProps.propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;

  i = GetPropIndex( oaOpenProps, Constants.FS_UpdateTextReferences );

  oaOpenProps.propVal.ival = Constants.FV_DoNo;

  i = GetPropIndex( oaOpenProps, Constants.FS_UpdateXRefs );

  oaOpenProps.propVal.ival = Constants.FV_DoNo;

    if( sOptions != null && sOptions.match( "silent" ) )

    {

  i = GetPropIndex( oaOpenProps, Constants.FS_AlertUserAboutFailure );

  oaOpenProps.propVal.ival = false;

  }

  else

  {

  i = GetPropIndex( oaOpenProps, Constants.FS_AlertUserAboutFailure );

  oaOpenProps.propVal.ival = true;

  }

  i = GetPropIndex( oaOpenProps, Constants.FS_UseRecoverFile );

  oaOpenProps.propVal.ival = Constants.FV_DoShowDialog;

    if( sOptions != null && sOptions.match( "readonly" ) )

    {

  i = GetPropIndex( oaOpenProps, Constants.FS_OpenDocViewOnly );

  oaOpenProps.propVal.ival = true;

  }

    else

    {

  i = GetPropIndex( oaOpenProps, Constants.FS_FileIsInUse );

  oaOpenProps.propVal.ival = Constants.FV_ResetLockAndContinue;

  }

    if( sOptions != null && sOptions.match( "new" ) )

    {

  i = GetPropIndex( oaOpenProps, Constants.FS_NewDoc );

  oaOpenProps.propVal.ival = true;

  }

  oaRetParms = new PropVals( );

  oDocOpen = Open( sFilename, oaOpenProps, oaRetParms );

  if( oDocOpen.ObjectValid( ) )

  {

  return oDocOpen;

  }

  else

  {

  return null;

  }

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

The dialog box is not displaying because of his code. It is displaying when the book is being created and one of the topics pops up that has a missing image. I got mine to pop up without running any code at all. When you follow the steps in my post, do you see the message pop up?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

Of course the dialog pops up when I manually open a file in FM - as there is no way to manually open a file invisibly in FM. That is why I use scripts to do stuff automatically without bringing the files to the screen.

It could be an enhancement if the FM developers would add one more option to the Alert preferences - do not show a dialog about missing images being replaced by grey boxes and just get on with it". But the dialog realliy cannot be marked down as a bug. Frame opens a file on the screen and tries to render the images - when the image is missing, it notifies you of that fact. I know tons of systems that would simply refuse to do anything at this point.

I am creating scripts for FrameMaker that will run on a FrameMaker Publishing Server - which does not even have a user interface to show files or dialogs. I am well aware of the dangers of dialogs popping up, whch is why I open files invisibly via scripts and have all messages suppressed. If code has to run overnight, there is no need to make any of it visible on a screen, as there will not be anyone watching that screen.

For such cases, my script offers a solution. I thought that was what Gabe was looking for. In fact, I would use a different approach to converting DITA maps with all its topics to FrameMaker books - using XSLT. But that requires more time than I am willing to offer here as free advice.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

OK, now you are getting it. The dialog box is not popping up when gabe's script opens the ditamap. It is popping up as FrameMaker creates the book after his Save command. As far as I can tell, when FrameMaker saves a ditamap to a book, it doesn't create the book invisibly; it just opens each topic as it adds them to the book as components. This is what is causing the dialog box to pop up.

You can see that in his original screenshot. He has already done the scripted save of a ditamap to a FrameMaker book with components. As FrameMaker builds the book and adds components, it is apparently popping up this message as it opens a topic with a missing graphic. As far as I can see, there is no parameter on the save to a FrameMaker book from a ditamap that will cause the book to build invisibly.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

This was not exactly clear from the initial post, but OK.

There might be a parameter in one of the DITA INI files that controls this, but I doubt it. I have wanted to replace the entire DITA client for a long time, but never had the time to do so.

As I mentioned in my previous reply I wold run an XSLT on the DITA map to create an XML representation of a FM book, which can then be opened whenever the author needs to work with the FM book. The XSLT will not pop up the dialog 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

This is exactly what is happening.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines