Skip to main content
Geppetto Luis
Legend
October 29, 2019
Answered

healing brush tool select samples

  • October 29, 2019
  • 1 reply
  • 1215 views

I can't find the script that allows me to select the desired sample

the discussion on this was present in the old forum
unfortunately it has been canceled

someone could post the script in question.

 

This topic has been closed for replies.
Correct answer r-bin
try
    {
    // select tool
    var d = new ActionDescriptor();
    var r = new ActionReference();
    r.putClass(stringIDToTypeID("magicStampTool"));
    d.putReference(stringIDToTypeID("null"), r);
    executeAction(stringIDToTypeID("select"), d, DialogModes.NO);


    var r = new ActionReference();
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

    var ret = executeActionGet(r);

    var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));           
    var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

    // Current layer
    options.putBoolean(charIDToTypeID("StmS"), false);
    options.putBoolean(charIDToTypeID("StmB"), false);

    // Current & below
    //options.putBoolean(charIDToTypeID("StmS"), true);
    //options.putBoolean(charIDToTypeID("StmB"), true);


    // All layers
    //options.putBoolean(charIDToTypeID("StmS"), true);
    //options.putBoolean(charIDToTypeID("StmB"), false);

    var r = new ActionReference();
    r.putClass(tool);

    var d = new ActionDescriptor();
    d.putReference(stringIDToTypeID("null"), r);
    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);

    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    }
catch (e) { alert(e)  }

1 reply

r-binCorrect answer
Legend
October 31, 2019
try
    {
    // select tool
    var d = new ActionDescriptor();
    var r = new ActionReference();
    r.putClass(stringIDToTypeID("magicStampTool"));
    d.putReference(stringIDToTypeID("null"), r);
    executeAction(stringIDToTypeID("select"), d, DialogModes.NO);


    var r = new ActionReference();
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

    var ret = executeActionGet(r);

    var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));           
    var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

    // Current layer
    options.putBoolean(charIDToTypeID("StmS"), false);
    options.putBoolean(charIDToTypeID("StmB"), false);

    // Current & below
    //options.putBoolean(charIDToTypeID("StmS"), true);
    //options.putBoolean(charIDToTypeID("StmB"), true);


    // All layers
    //options.putBoolean(charIDToTypeID("StmS"), true);
    //options.putBoolean(charIDToTypeID("StmB"), false);

    var r = new ActionReference();
    r.putClass(tool);

    var d = new ActionDescriptor();
    d.putReference(stringIDToTypeID("null"), r);
    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);

    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    }
catch (e) { alert(e)  }
Geppetto Luis
Legend
November 1, 2019

Mr. r-bin
Thanks for your super help