• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Setting eyedropper options

Participant ,
Sep 10, 2018 Sep 10, 2018

Copy link to clipboard

Copied

Hey guys,

Some time ago, I had a question about using javascript to perform a select color range. It works, but it uses whatever sample options were set before running the script. It would be nice if I were able to set the Sample option to "Current Layer" via script.

Is there a way to do that?

TOPICS
Actions and scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Sep 10, 2018 Sep 10, 2018

CC2018

// remember old tool

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));

r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var curr_tool = executeActionGet(r).getEnumerationType(stringIDToTypeID("tool"));

// select eyedropper tool

var r = new ActionReference();

r.putClass(stringIDToTypeID("eyedropperTool"));

var d = new ActionDescriptor();

d.putReference(stringIDToTypeID("null"), r);

execut

...

Votes

Translate

Translate
Adobe
People's Champ ,
Sep 10, 2018 Sep 10, 2018

Copy link to clipboard

Copied

CC2018

// remember old tool

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));

r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var curr_tool = executeActionGet(r).getEnumerationType(stringIDToTypeID("tool"));

// select eyedropper tool

var r = new ActionReference();

r.putClass(stringIDToTypeID("eyedropperTool"));

var d = new ActionDescriptor();

d.putReference(stringIDToTypeID("null"), r);

executeAction(stringIDToTypeID("select"), d, DialogModes.NO);

// get and set eyedropper tool options

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));

r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var op = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));

op.putInteger(stringIDToTypeID("eyeDropperSample"), 0);      // point sample

op.putInteger(stringIDToTypeID("eyeDropperSampleSheet"), 1); // current layer

var r = new ActionReference();

r.putClass(stringIDToTypeID("eyedropperTool"));

var d = new ActionDescriptor();

d.putReference( stringIDToTypeID( "null" ), r );

d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), op);

executeAction(stringIDToTypeID("set"), d, DialogModes.NO);

// select old tool

var r = new ActionReference();

r.putClass(curr_tool);

var d = new ActionDescriptor();

d.putReference(stringIDToTypeID("null"), r);

executeAction(stringIDToTypeID("select"), d, DialogModes.NO);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

LATEST

awesome. thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines