Monday, April 14, 2008

Never Say Die

This morning I got a request from Karl Stanton from Melbourne, asking about "changing the color of an object inside a blend."

Sadly(...maddeningly...frustratingly), as you may know, access of a "plug-in" item is not directly possible using JavaScript. 

Now, I saw the word "plug-in" in his email, and immediately thought "hopeless" and I told him it was not possible.  
Not easily discouraged, Karl wrote back and suggested that it may be possible to access the objects color indirectly using the swatch palate.  He was, however, having trouble getting the object to stay bound to the swatch when the swatch was changed with JS.

I ran a quick test myself and was able to make it work by setting the swatch to a spot color, and then changing the RGB color values inside the spot, i.e.;

var doc = activeDocument;


Had Karl given up after my first response, or had I persisted in my belief that it was impossible, we would never have discovered that changing a color inside a plug-in object actually IS possible.  So folks... The moral of the story (or the morrel if you like mushrooms), is "Never Say Die."

And on that front... "Hi everybody..."
...I have a neat 'grouping' script coming soon... I promise...

stay tuned,

No comments: