I have simple scriptUI where is button that calls simple function. Function works properly if I call it normally out of button, but when I try to change color after button clicked, nothing happened.
I tried change colors with simple RGB way and now I tested out this CMYK version that found from forum. Nothing seems to be working via that button. Function itself lauches, but colors doesn't affect. Am I miss something about scriptUIs...
Please, anyone know where is the problem?
#target illustrator //changeColor(); function changeColor() { var docRef = app.activeDocument; var col; var col = new CMYKColor(); col.cyan = 2; col.magenta = 3; col.yellow = 15; col.black = 0; // Create the new swatch using the above color var swatch = docRef.swatches.add(); swatch.color = col; swatch.name = "col"; // Apply the swatch to a new path item var pathRef = docRef.pathItems[0]; pathRef.filled = true; pathRef.fillColor = swatch.color; } createGUI (); function createGUI() { var win = new Window("palette", "Test", [150, 150, 460, 455]); // bounds = [left, top, right, bottom] windowRef = win; win.increaseColorBtn = win.add("button", [110,50,200,150], "Change"); win.increaseColorBtn.onClick = function () { changeColor (); }; // Create quit button and trigger for it win.quitBtn = win.add("button", [110,275,200,295], "Close"); win.quitBtn.onClick = function() { win.close(); } win.show(); }