InDesign find object preferences

Community Beginner ,
May 03, 2021 May 03, 2021

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:

app.findObjectPreferences.objectType = ObjectTypes.GRAPHIC_FRAMES_TYPE;
 
Message returned: 
Error Code# 55: Object does not support the property or method 'objectType' @ file '~/Documents/Tweak/InDesign/Graphic%20Frame%20Fix.jsx'
 
How do I set the preference and get an array of the objects?

Views

98

Likes

translate

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 ,
May 03, 2021 May 03, 2021

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.

Likes

translate

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 ,
May 03, 2021 May 03, 2021

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 )

Likes

translate

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
Community Beginner ,
May 03, 2021 May 03, 2021

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

 

 

Likes

translate

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 ,
May 04, 2021 May 04, 2021

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:

 

FrameSelected-DoneWith-RectangleFrameTool.PNG

FrameSelected-DoneWith-RectangleTool.PNG

 

 

After running the script:

 

FrameColored-DoneWith-RectangleFrameTool.PNG

 

Only the frame done with the Rectangle Frame tool was found and fill color was changed.

 

Regards,
Uwe Laubender

( ACP )

Likes

translate

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