Skip to main content
Participant
April 16, 2013
Question

Apply script on specific pages only

  • April 16, 2013
  • 1 reply
  • 1542 views

Hi!

I would like to know how to apply some script on specific pages only.

I would like to apply it on pages number 4 to 50 on a 50 page project, and so exclude page 1, 2 and 3.

Here is my actual script:

var doc = app.activeDocument,
objStyle = doc.objectStyles.itemByName('stylenamechosen'),
a = doc.allGraphics,
i = a.length;
while( i-- ) a.parent.appliedObjectStyle = objStyle;

Please let me know.

This topic has been closed for replies.

1 reply

Jump_Over
Legend
April 17, 2013

Hi,

In case of your question you should modify the line:

a = doc.allGraphics,

with:

a = doc.pages.itemByRange(3,-1).allGraphics,

but basically:

are you going to apply objectStyle to a graphics (images, pdfs, eps, etc) or to a frames which are their containers (rectangles, ovals, etc)?

Jarek

Community Expert
April 17, 2013

@Jarek – MISESAJOUR is applying object styles to the parent of a graphic.
And that is the container.

a = doc.allGraphics

a.parent.appliedObjectStyle = objStyle

Uwe

Jump_Over
Legend
April 17, 2013

@Uwe,

Yea, right. I've overseen this... Thanks

Jarek