Copy link to clipboard
Copied
Hello,
Please can have a look to my capture screen and help me to write the code in JavaScript to get this kind of errors (and wich text is concerned by this error) ? In Indesign desktop, these errors are displayed in the pannel "Contrôle en amont").
Thks for your help.
Copy link to clipboard
Copied
Hi @Vincent42,
You need to dig a bit deeper into the InDesign DOM to understand scripting for IDS. The first and foremost thing to keep in mind is that you don't have access to UI elements like panel, other things like selection, activeDocument, etc in IDS. So we need to modify our code a bit to make it work on IDS. Now in your case you are trying to identify an error condition of overset on the textframe. Checking the properties of textframe we can see a property that tells us exactly this, the property is overflows
So now you need to just get a reference to the textframe that you need to check and see if the property is set. Something like the following should work
if(app.documents[0].textFrames[0].overflows == true)
alert("First textframe of the document has an overset error")
else
alert("No overset detected")
-Manan
Copy link to clipboard
Copied
Hi Vincent,
or is it the whole feature Preflight you like to access by scrpting InDesign server?
That would be the same with server and the desktop version. A given preflight profile could be loaded, results could be processed. Look into DOM documentation for this and work through all of the options:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PreflightOption.html
You may find also some code snippets in this forum like this one:
https://community.adobe.com/t5/indesign/script-to-provide-preflight-options/m-p/10938694#M176367
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
When working with Preflight scripting be aware that there might be some bugs as well. Like this subtle one:
PreflightScope not working
Patrik, Mar 5, 2020
Read the comments there.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi,
My 2 cents, if you are looking to check for things so you can handle them later you can use this structure which can reduce a lot of the work, does depend on what you are looking for.
var oversetString = app.documents[0].pages.everyItem().textFrames.everyItem().overflows.toString();
if (oversetString.indexOf("true") != -1){
// you have overset text, so you can handle it
} else {
// no overset text in the documents textframes.
}
Malcolm