Copy link to clipboard
Copied
Hi,
We have a document that causes InDesign to crash while opening. This document uses our custom C++ plugin.
With the debug version of InDesign following prompts are shown before InDesign crashes
Copy link to clipboard
Copied
Sounds like that UID is supposed to refer to a preflight profile, Could be the active prefilght profile that is exercised on load unless you disable preflight that hard way removing its plugin?
Not being able to get the class ID means there is no such object, it was deleted,
Copy link to clipboard
Copied
What happens if you open the doc without UI – so the preflighting task does not kick in – (by script) and create+assign a different preflight profile?
Copy link to clipboard
Copied
Please suggest how to open the doc without UI (by script)
In the meanwhile, I opened a new document and set the preflight to off. Then I opened the original document and InDesign crashed again.
Copy link to clipboard
Copied
the second argument to app.open is a bool "showingWindow".
https://developer.adobe.com/indesign/dom/api/a/Application/
The hard part will be to find out yourself how to disable preflight by script, or create another profile and assign that as active. Sorry, can't help with that.
Then close (again by script) and hope that regular open now works.
Copy link to clipboard
Copied
Hi @asaxena ,
if you are able to open the document without a layout window, you could export to IDML, open the IDML file and save it to a new named document.
ExtendScript code below, read also into my comments in the code:
// To avoid messages set the user interaction level to "Never interact":
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT ;
var getINDDFile = File.openDialog
(
"Open InDesign File" ,
"*.indd",
false
);
if( getINDDFile == null )
{
alert( "NO INDD FILE SELECTED." );
// Reset script preferences:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL ;
exit();
};
// Open INDD file WITHOUT a layout window:
app.open( getINDDFile , false );
var doc = app.documents[0];
var docFilePath = doc.filePath;
var idmlFileName = doc.name.replace(/\.indd$/ , "-IDML.idml" );
var idmlFile = File( docFilePath +"/"+ idmlFileName );
// Export doc without layout window to IDML:
app.documents[0].exportFile( ExportFormat.INDESIGN_MARKUP , idmlFile );
// Close original document without saving:
app.documents[0].close( SaveOptions.NO );
// Open exported IDML file without a layout window:
app.open( idmlFile , false );
var newDocName = idmlFileName.replace( /\.idml$/ , ".indd" );
var newDocFile = File( docFilePath +"/"+ newDocName );
app.documents[0].save( newDocFile );
app.documents[0].close( SaveOptions.NO );
// Resetting the script preferences:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL ;
alert( "Done" );
Code tested with InDesign 2024 version 19.5.0.84 on macOS.
No idea, if that will help in your case.
Regards,
Uwe Laubender
( Adobe Community Expert )