Skip to main content
Known Participant
April 30, 2022
Question

How to Replace ( change ) Graphic Frames with other from my choice

  • April 30, 2022
  • 3 replies
  • 1525 views

Hello

I have an indesign file consists of 1000 pages with  graphic frames containes 1000 images and I want to replace this graphic frame automatically with another graphic frame from my choice .

How can I do that  .... Is there a script to do that ?

Thanks

 

 

This topic has been closed for replies.

3 replies

Community Expert
April 30, 2022

"I want to replace this graphic frame automatically with another graphic frame from my choice."

"I assumed that is script ot method to make that."

 

Hi ramy5FDA,

that requires additional effort and more information from your side.

 

Let me explain:

So you copied over an arbitrary shape from Illustrator or you drew your own arbitrary shape in InDesign. It consists of one single path, it is not a compound path object or a group of objects.

 

How would you like to apply that shape to the frames you already have for all of your graphics in your document?

 

[ 1 ] Should all the target's frames stroke or fill be changed to the one you have as a new blueprint?

[ 2 ] Should the size of your blueprint frame be maintained when the target frame's shape is changing?

[ 3 ] Should the new shape be centered to the old shape of the old frame with your graphic?

[ 4 ] Should the position and size of the graphic change when the new frame's shape is applied?

E.g. should the graphic fill the new shape proportionally?

 

Regards,
Uwe Laubender

( ACP )

ramy5FDAAuthor
Known Participant
April 30, 2022

Thanks for Your Reply

main indesign file that I speak about that created by data merge with images , the current circle frame I put in Master Page 

I want to replace or convert this circle frame to any another frame from illustrator ( not shapes found in indesign ) and images fill the new frame proportionally

 

Community Expert
April 30, 2022

Hm… Then prepare the template layout of your data merge with the shape from Illustrator.

 

Regards,
Uwe Laubender

( ACP )

 

 

rob day
Community Expert
Community Expert
April 30, 2022

This script will set all the document’s graphic frames to ovals

 

var g = app.documents[0].allGraphics;
for (var i = 0; i < g.length; i++){
    g[i].parent.convertShape(ConvertShapeOptions.CONVERT_TO_OVAL)
};  

 

ramy5FDAAuthor
Known Participant
April 30, 2022

Thanks for your Reply with this script

And please tell me what can I do if i want to change oval to any other graphic frame

 

rob day
Community Expert
Community Expert
April 30, 2022

The convertShape options are:

 

ConvertShapeOptions.CONVERT_TO_BEVELED_RECTANGLE

ConvertShapeOptions.CONVERT_TO_CLOSED_PATH

ConvertShapeOptions.CONVERT_TO_INVERSE_ROUNDED_RECTANGLE

ConvertShapeOptions.CONVERT_TO_LINE

ConvertShapeOptions.CONVERT_TO_OPEN_PATH

ConvertShapeOptions.CONVERT_TO_OVAL

ConvertShapeOptions.CONVERT_TO_POLYGON

ConvertShapeOptions.CONVERT_TO_RECTANGLE

ConvertShapeOptions.CONVERT_TO_ROUNDED_RECTANGLE

ConvertShapeOptions.CONVERT_TO_STRAIGHT_LINE

ConvertShapeOptions.CONVERT_TO_TRIANGLE

 

 

So this would find the ovals with a graphic inside and convert its frame to a rectangle:

 

var g = app.documents[0].allGraphics;
for (var i = 0; i < g.length; i++){
    if (g[i].parent.constructor.name == "Oval") {
        g[i].parent.convertShape(ConvertShapeOptions.CONVERT_TO_RECTANGLE)
    } 
};

 

ramy5FDAAuthor
Known Participant
April 30, 2022

Is there any solution to do that ?

jmlevy
Community Expert
Community Expert
April 30, 2022

I am not sure to understand. There are 1000 different images and you want to replace each image by 1000 new images?

ramy5FDAAuthor
Known Participant
April 30, 2022

Thanks for your Replay

No , I want to replace the Placeholder graphic Frames that contain images ( Container ) with another placeholder graphic frame

Images Remain without change