Skip to main content
Participant
March 15, 2017
Question

Color applied object change color

  • March 15, 2017
  • 1 reply
  • 540 views

I wrote this code

But I am getting the error Why?

var findC = [

"C=100 M=0 Y=0 K=0",

"C=0 M=0 Y=100 K=0"

]

changeC = [

"C=15 M=100 Y=100 K=0",

"C=75 M=5 Y=100 K=0"

]

var doc = app.activeDocument; 

app.findObjectPreferences = app.changeObjectPreferences = null; 

for(var i = 0; i < findC.length; ++i) {

  

  

app.findObjectPreferences.fillColor = app.activeDocument.swatches.itemByName(findC);

app.changeObjectPreferences.fillColor =app.activeDocument.swatches.itemByName(changeC);

app.changeObject(); 

      }

app.findObjectPreferences = app.changeObjectPreferences = null; 

This topic has been closed for replies.

1 reply

Community Expert
March 15, 2017

Hi,

would you like to tell what "the" error is?
And what line is throwing this?

Thanks,

Uwe

Community Expert
March 15, 2017

Hm.

Your code is missing at least one comma and at semicolon.

FWIW: I think, findObjectPreferences is broken with InDesign scripting.

There is at least one fundamental bug.

If I apply a color like "C=100 M=0 Y=0 K=0" to the fill property in the UI,

app.findObjectPreferences.fillColor returns an error.

The equivalent of: $ID/kScriptErrNotApplicable

In my German InDesign: "Diese Eigenschaft ist im aktuellen Status nicht zutreffend."


Tested with CS6 8.1.0 on OSX 10.6.8.

What is your exact version of InDesign and OS ?

Regards,
Uwe

Participant
March 15, 2017

I use İndesing CS6 and in windows10

This error:

Invalid value for cluster property "fillColor". Expected Swatch, String or NothingEnum enumerator but received Color

Line text:

app.findObjectPreferences.fillColor = app.activeDocument.swatches.itemByName(findC);