Copy link to clipboard
Copied
I need to search for every empty graphic frame in my document, export it as PNG, and re-import the PNG into the frame.
Before I can find, though, it seems I need to set the proper setting:
Tried the following but keep getting an error:
Copy link to clipboard
Copied
I've moved this from the Using the Community forum (which is the forum for issues using the forums) to the InDesign forum so that proper help can be offered.
Copy link to clipboard
Copied
Hi Tim,
your InDesign is right.
objectType is not part of app.findObjectPreferences.
You'll find that in app.findChangeObjectOptions.
See into ExtendScript's DOM documentation for InDesign compiled by Gregor Fellenz:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#FindChangeObjectOption.html#d1e337707
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Thanks for your input. I saw that there is also an app.findOjectOptions in the link you posted. But is there another way to get the objects.
I have written a few scripts that have been very useful for me but I am having trouble working out exactly where to address objects in the DOM.
How do I get an array of all page Items that are ObjectTypes.GRAPHIC_FRAMES_TYPE
Copy link to clipboard
Copied
Hi Tim,
I don't know what you expect with a search on Graphic Frame Type.
You'll find only objects that are created with the graphic frame tools:
UITools.POLYGON_FRAME_TOOL
UITools.RECTANGLE_FRAME_TOOL
UITools.ELLIPSE_FRAME_TOOL
You will not find frames created with:
UITools.POLYGON_TOOL
UITools.RECTANGLE_TOOL
UITools.ELLIPSE_TOOL
Sample code:
app.findChangeObjectOptions.properties =
{
includeFootnotes : true ,
includeHiddenLayers : true ,
includeLockedLayersForFind : true ,
includeLockedStoriesForFind : true ,
includeMasterPages : true ,
objectType : ObjectTypes.GRAPHIC_FRAMES_TYPE
};
app.findObjectPreferences = null ;
// Scope is the active document:
var doc = app.documents[0];
var resultArray = doc.findObject();
// Change the fill color of all found objects to "Yellow":
for( var n=0; n<resultArray.length; n++ )
{
resultArray[n].fillColor = doc.colors.itemByName( "Yellow" );
};
Run this code against a document that contains only two rectangles; one recatngle done with the Rectangle Frame tool, the other one with the Rectangle tool:
After running the script:
Only the frame done with the Rectangle Frame tool was found and fill color was changed.
Regards,
Uwe Laubender
( ACP )