Skip to main content
brian_p_dts
Community Expert
Community Expert
November 4, 2025
Question

[Script] Problem with changing colors using selection and doc.defaultFillColor

  • November 4, 2025
  • 1 reply
  • 71 views

Hi all, in one of the more recent updates to Illustrator, I have been unable to change a selection's fill color using, for example, the following: 

    var doc = app.activeDocument;
    var sel = app.selection[0];
    var grayCol = new RGBColor();
            grayCol.red = 211;
            grayCol.green = 211;
            grayCol.blue = 211;
        doc.selection = null;
        var defColor = doc.defaultFillColor;
        doc.defaultFillColor = grayCol;

 There error I receive is a PARM error: "there is no document "

I have seen this behavior with a single simple page item selection, an app.executeMenuCommand(

"Find Fill Color menu item") or multiselection.
 
I have seen this across a few different scripts I've written. Think I saw it a couple months ago.  Anyone else seen this and figured out a workaround, other than trying to change the selection's .fillColor property? 

1 reply

CarlosCanto
Community Expert
Community Expert
November 4, 2025

that sample script works fine here. I'm on Windows 11, Illustrator v30.0