Skip to main content
rcraighead
Legend
February 14, 2019
Answered

Apply Graphic Style to selection?

  • February 14, 2019
  • 1 reply
  • 692 views

I tried but get "Undefined is not an Object". What am I doing wrong?

var doc = app.activeDocument; 

 

var gStyle = doc.graphicStyles.getByName("R1_C1"); 

gStyle.applyTo.doc.selection;

This topic has been closed for replies.
Correct answer pixxxelschubser

Hi rcraighead​,

wrong syntax:

gStyle.applyTo(doc.selection[0]);

Have fun

1 reply

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
February 14, 2019

Hi rcraighead​,

wrong syntax:

gStyle.applyTo(doc.selection[0]);

Have fun

rcraighead
Legend
February 14, 2019

Thank you pixxxel! I tried several things but not the ( ) around it all.

pixxxelschubser
Community Expert
Community Expert
February 14, 2019

You're welcome.

Yes. That was one thing.

The second:

'selection' is a property of a class.

applyTo() works on object(s)