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

Get feedback from app.showColorPicker(startColor) when someone click Cancel?

Participant ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

This code below works fine, but if in the color picker someone click Cancel instead Ok what app.showColorPicker(startColor) return is not false/undefined or similar but startColor.

Does somone know how to get feedback when cancel is clicked that that is cancel and not startColor?

 

Code:

var startColor = createCMYK ([1,1,1,1]);
var result = app.showColorPicker(startColor);

$.writeln([result.cyan, result.magenta, result.yellow, result.black])


function createCMYK (inputColors){

var newColor = new CMYKColor();
newColor.cyan = inputColors[0];
newColor.magenta = inputColors[1];
newColor.yellow = inputColors[2];
newColor.black = inputColors[3];
return newColor
}

 

 

TOPICS
Scripting , SDK

Views

162

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
Adobe
Community Expert ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

Hi @livl17017666, I don't have an answer, except to confirm your observation and code. (AI 28.3, MacOS 14.3.1) Personally, I consider this to be a bug. If no-one else has a better explanation, you can report the bug here.

- Mark

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 Expert ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

same results here as well.

 

is startColor meaningful? (is there a chance the user clicks ok accepting the startColor)? If not, then you could compare  the returned color and assume Cancel was pressed if it's the same as startColor

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 ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

LATEST

That color picker is called from button, and button change color based on what color is selected.

And when button already had some color, that color is sent to color picker, in the case cancel is clicked it will send back same color, so everything is fine.

But in the case button is without color ([None]), still some startColor needs to be sent to color picker, and yes is could be some color with cmyk numbers which has decimal numbers and similar where there is very low probability that user will select that color as you suggest and based on that will be possible to detect that it is cancal is clicked if send back same color.

But thing is people do not always select color based on number it could be that that sent color will be just fine for user. In that case user will not be able to select that color it will look like bug where it will not be able to change color.

 

I though to maybe send random values for cmyk on each run of color picker in tha case where button is without color. To deacrese probability but still even that there is chance that color is fine, because maybe for user will be good any color.

 

If someone has some other solution, please let me now?

 

Thank you. 

 

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