Skip to main content
Inspiring
July 18, 2014
Question

Change the fill color of an object in illustrator using extendscript

  • July 18, 2014
  • 1 reply
  • 2601 views

Hi

I have a script that scan through items on the page in an illustrator file. I would like to be able to say if a particular colour is found, say c=0, m=0,y=100,k=0 (yellow) change that colour to cyan. I'd like to use an if statement so

  if (currentItem.fillColor= c=0, m=0,y=100,k=0) {

code to change it to c=100, m=0,y=0,k=0 in here

}

Really struggling with this and thought it would be obvious.

Alternativly is it possible to specify a colour and change all the items on a page that are that colout to a different colour. I the same way that you would use the select same fill colour from the Select menu

Many thanks in advance

Bob

This topic has been closed for replies.

1 reply

Inspiring
July 18, 2014

You can script the search and replacement of colours… It will NOT be anything like the speed of the built-in app ones as they are provided by plug-ins and are much faster…

Depending on your app version you may be able to record action and play that out…?

Inspiring
July 18, 2014

Yes, thats what I'm trying to do. I need to set a set of colours, then run the script which finds the colours I've specified in the script and changes them to other specific greys. I should explain we generate lots of charts by automation to go both online and in print. Some of our print sites only do black and white so we have to change the colours. We have to be able to map specific CMYK colours onto specific greys rather then leave it to the built in filter as the tonal difference sometime becomes unclear on certain line charts. Its the actual how do I do it bit I'm struggling with

Inspiring
July 18, 2014

When you say 'charts' do you mean AI live graphs…?