Skip to main content
_wckdTall_
Inspiring
July 9, 2026
Question

Get app.findColorPreferences.findWhat property value

  • July 9, 2026
  • 2 replies
  • 58 views

I’m looking for a way to read the value app.findColorPreferences.findWhat, and find out what swatch it’s currently looking for. It gives the error 30615 The property is not applicable in the current state.

I am able to set it:

app.findColorPreferences.findWhat = app.activeDocument.swatches.item("SWATCH_NAME")


Is there a way to read what swatch is currently selected in the dialog, similar to findGrepPreferences and findTextPreferences?

    2 replies

    nik.m
    Community Manager
    Community Manager
    July 22, 2026

    Hi ​@_wckdTall_, just checking in to see if the suggestions from our Experts helped, or if you still need help.

    If yes, please let us know and we'll be happy to assist further.

    Thanks,
    Nikunj

    Community Expert
    July 9, 2026

    You can read the Find Colour setting like this:

    var currentFindColor = app.findColorPreferences.findWhat;

    if (currentFindColor === NothingEnum.NOTHING) {
    alert("No Find Color swatch is set.");
    } else if (currentFindColor && currentFindColor.isValid) {
    alert("Current Find Color swatch: " + currentFindColor.name);
    }

    But this is reading InDesign’s Find/Change preference, not the open Find Colour dialog itself.

    Could be best to remember the swatch yourself when you set it:

    var swatch = app.activeDocument.swatches.itemByName("SWATCH_NAME");

    app.findColorPreferences.findWhat = swatch;

    // remember what your script set
    var currentFindColorSwatchName = swatch.name;

    That way, your script is not relying on checking the dialog later. It already knows what value it assigned.

     

    And maybe clear the Find/Change preferences when finished

    app.findColorPreferences = NothingEnum.NOTHING;

     

    _wckdTall_
    Inspiring
    July 14, 2026

    Thanks! That’s what I was seeing as well, that app.findColorPreferences.findWhat produces an error and cannot be read.

     

    rob day
    Community Expert
    Community Expert
    July 15, 2026

    Hi ​@_wckdTall_ , findWhat expects a swatch, so here swatches.itemByName() works

     

    alert(colorSearch(doc, "Blue"))
    //returns 3

    function colorSearch(d, fc){
    //clear F&C
    app.findColorPreferences = app.changeColorPreferences = app.findChangeColorOptions = null;
    app.findColorPreferences.findWhat = d.swatches.itemByName(fc);
    alert(d.swatches.itemByName(fc).name)
    //returns Blue
    app.findColorPreferences.tint = 100;
    //findColor returns a number
    return app.activeDocument.findColor()
    }