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

Where do I find tool properties/options?

Community Beginner ,
Sep 29, 2022 Sep 29, 2022

Copy link to clipboard

Copied

Hi, I was wondering if there was a reference to see the names of the tool options, and if I am able to have a script show me the current tool options and their values.

 

As an example, I would like to get what the current feather of the marquee rectangle tool is and what the property is called if I would like to set a new value.

 

Thanks!

 

TOPICS
Actions and scripting

Views

215

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

Guide , Sep 29, 2022 Sep 29, 2022
var s2t = stringIDToTypeID,
	c2t = charIDToTypeID;

currentTool = 'marqueeRectTool';

// see the names of all the tool options
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
(d = new ActionDescriptor()).putObject(s2t('object'), s2t('object'), executeActionGet(r));
eval('t = ' + executeAction(s2t('convertJSONdescriptor'), d).getString(s2t('json')));

alert(t.toSource());

// get only feather value
...

Votes

Translate

Translate
Adobe
Guide ,
Sep 29, 2022 Sep 29, 2022

Copy link to clipboard

Copied

var s2t = stringIDToTypeID,
	c2t = charIDToTypeID;

currentTool = 'marqueeRectTool';

// see the names of all the tool options
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
(d = new ActionDescriptor()).putObject(s2t('object'), s2t('object'), executeActionGet(r));
eval('t = ' + executeAction(s2t('convertJSONdescriptor'), d).getString(s2t('json')));

alert(t.toSource());

// get only feather value
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
var feather = executeActionGet(r).getObjectValue(s2t('currentToolOptions')).getUnitDoubleValue(c2t('MrqF'));

alert (feather);

//  set a new feather value.
var newValue = 50;
(d = new ActionDescriptor()).putUnitDouble(c2t('MrqF'), s2t('pixelsUnit'), newValue);
(r = new ActionReference()).putClass(s2t(currentTool));
(d1 = new ActionDescriptor()).putReference(s2t('target'), r);
d1.putObject(s2t('to'), s2t('target'), d);
executeAction(s2t('set'), d1, 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
Community Beginner ,
Sep 29, 2022 Sep 29, 2022

Copy link to clipboard

Copied

LATEST

Wow! Thanks again! Still have a lot to learn 🙂

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