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

Functionality Not Available This Version PS

New Here ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

Extendedscript Tooklit CC 4.0.0.1 displays "General Photoshop error occurred.  This functionality may not be available in this version of Photoshop." upon reaching the following code:

var red = Math.round(color.getDouble(cTID('Rd  ')));

Where color if of type:  color = [ActionDescriptor]

I have included:

#target photoshop

#include "/Developer/xtools/xlib/stdlib.js"

I'm a new xtools user and believe the error is caused within the "color.getDouble(cTID('Rd  ')) " portion of the statement.  I can't find these methods within xtools; so I don't know if something else should be #included.  My setup is:  Photoshop CC 2017.0.1 Release, xtools v2.3 and OS X 10.12.3.

Thank you.

P.S.  (My goal is to obtain the solid fill color of an adjustment layer.)

TOPICS
Actions and scripting

Views

1.8K

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

Advisor , Mar 06, 2017 Mar 06, 2017

Create a SolidColor object and assign the values into SolidColor.cmyk. You can then get the RGB values from the SolidColor.rgb.

The array of Strings that Stdlib.getDescriptorKeyNames returns are proper names for the keys, not the ids you need to use.

The ids you need are cTID('Cyn '), cTID('Mgnt'),  cTID('Ylw '), and cTID('Blck').

Votes

Translate

Translate
Adobe
Advocate ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

Can you get other error messages when you run the script from ExtendScript Toolkit in debug mode?

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
New Here ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

I'm new to ExtendedScript Toolkit.  When you write "in debug mode" do you mean making use of the step over, step into, etc. buttons or is debug mode a state for toolkit that is specifically set?

When using the step over button no errors occur until var red = Math.round(color.getDouble(cTID('Rd  '))); is reached.

The function which contains this statement is a recent addition to my script which previously ran without error.

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
Advisor ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

cTID is in stdlib.js.

getDouble is a method on ActionDescriptor. This is part of PS/JS.

There are too possible problems.

cTID requires exacty four character. It looks like you're ok here.

The other problem is that the 'color' ActionDescriptor may not be and RGB color descriptor.

Try this to see what is actually in the descriptor:

var keys = Stdlib.getDescriptorKeyNames(color);

$.writeln(keys.join(' '));

It will print out the key names in the 'color' descriptor to the ESTK.

Place this just above the line that is causing you problems.

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
New Here ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

When I copy/paste

     var keys = Stdlib.getDescriptorKeyNames(color);

     $.writeln(keys.join(' '));

just above the statement

     var red = Math.round(color.getDouble(cTID('Rd  ')));

A "PSConstants is undefined" error occurs and the script jumps to:

Stdlib.getDescriptorKeyNames = function(desc) {

  var keys = [];

  for (var i = 0; i < desc.count; i++) {

    keys.push(PSConstants.reverseNameLookup(desc.getKey(i), "Key"));

  }

  return keys;

};

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
Advisor ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

My bad. You'll need to add

#include "/Developer/xtools/xlib/PSConstants.js"

after

#include "/Developer/xtools/xlib/stdlib.js"

That should work.

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
New Here ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

As per your suspicion, "color' ActionDescriptor may not be and RGB color descriptor"

var keys = Stdlib.getDescriptorKeyNames(color);

$.writeln(keys.join(' '));

returns keys = [Array] Cyan, Magenta, Yellow, Black.

Is there a way to get RGB or HSL values for each adjustment layer?  If not, how should I change

var red = Math.round(color.getDouble(cTID('Rd  ')));

to get the [Array] Cyan, Magenta, Yellow, Black?

I sincerely appreciate your help and apologize for accidentally including your code in my previous reply.

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
Advisor ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

LATEST

Create a SolidColor object and assign the values into SolidColor.cmyk. You can then get the RGB values from the SolidColor.rgb.

The array of Strings that Stdlib.getDescriptorKeyNames returns are proper names for the keys, not the ids you need to use.

The ids you need are cTID('Cyn '), cTID('Mgnt'),  cTID('Ylw '), and cTID('Blck').

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