Skip to main content
Inspiring
February 26, 2023
Question

Extendscript: DoOK for "Cannot display imported graphics"

  • February 26, 2023
  • 2 replies
  • 347 views

Dear friends,

 

I'm looking for the Open() function parameter that dismisses the "Cannot display imported graphics" message and lets the book component Open function loop continue.

 

I've tried:

i = GetPropIndex(params, Constants.FS_RefFileNotFound);
params[i].propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;

 

i = GetPropIndex(params, Constants.FS_AlertUserAboutFailure);
params[i].propVal.ival = Constants.FV_DoOK;

 

None of them helped dismiss the imported graphics error message. Will appreciate your input.

Thanks!

    This topic has been closed for replies.

    2 replies

    Participating Frequently
    July 25, 2023

    Hi, Rom_Ba
    You can use the following functions (Notification (), Notify (), ReturnValue ()) to handle alert dialogs.

    Notification (Constants.FA_Note_Alert, true);
    function Notify (note, object, sparam, iparam){
    	switch (note){
    		case Constants.FA_Note_Alert:
    			// handle errors as needed
    			Console ("object: " + object);
    			Console ("sparam: " + sparam);
    			ReturnValue (Constants.FR_CancelOperation);
    			break;
    	}
    }

    Use the following code at the end of your script to dismiss the notification.

    Notification (Constants.FA_Note_Alert, false);
    frameexpert
    Community Expert
    Community Expert
    February 26, 2023

    This annoying message should have a "Don't show this again" checkbox. I have complained about this for years. There is no way to programmatically dismiss it that I know of. However, here is a workaround: if your script is simply opening a document, changing it, then saving and closing it, you can add this to the Open function:

     

    i = GetPropIndex (openProps,Constants.FS_MakeVisible);
    openProps[i].propVal.ival = false;
    

    This will open the document but not make it visible on the screen so you won't see that message. It will also make your script run faster because it doesn't have to display the document on the screen.

     

    Note that some scripts need the documents to be visible in order to calculate the position of objects on the screen correctly. And you can't use FCodes on invisible documents.

    Rom_BaAuthor
    Inspiring
    February 26, 2023

    Hi Rick,

     

    Thank you for your response and for the workaround! I'm really surprised that Adobe haven't added a dedicated constant up until now. Moreover, I've noticed that Adobe no longer provide the ESTK on their website. Not clear what Adobe's plans regarding Extendscript are.

     

    The interesting thing is that when I added the Constants.FS_MakeVisible as you suggested and ran the script, the book components were open invisibly, as expected, but I started getting another prompt which I didn't get before: "The document contains unresolved cross-references". Not sure why it was triggered out of the blue. I had to disable those prompts via the Preferences menu.

     

    Thanks again,

    Roman