JS和JSX文件之间的函数通信问题

问题描述 投票:0回答:1

我已经将此function制成了JS文件...

function getColors(isPick, isForecolor)
{
    var chosenFunction = 'getColor(' + isPick + ', ' + isForecolor + ')';
    csInterface.evalScript(chosenFunction, function(result)
    {
        if(result !== 'undefined')
        {
            if (isForecolor == true){
                foregroundHexColor = result;
                // etc...
            }
            else
            {
                backgroundHexColor = result;
                //etc..
            };
        };
    });
};

哪个[[获取一种十六进制颜色来自此功能来自JSX文件。

function getColor(isPick, isForecolor) { var color_PickerCase; var decimal_Color; var hexadecimal_Color; if (isForecolor == true) { color_PickerCase = app.foregroundColor.rgb.hexValue; } else { color_PickerCase = app.backgroundColor.rgb.hexValue; }; if (isPick == true) { if (app.showColorPicker(isForecolor)){ decimal_Color = color_PickerCase; hexadecimal_Color = decimal_Color.toString(16); } else { return; }; } else { decimal_Color = color_PickerCase; hexadecimal_Color = decimal_Color.toString(16); }; return hexadecimal_Color; };
以某种方式起作用,但是由于某种原因,我必须做同样的事情

两次

才能获得价值!!!知道为什么会这样吗?谢谢您的时间!

UPDATE

:更正,仅在第一次单击时有效。然后需要单击两次以获取值!!!>我已将此函数制作为JS文件... function getColors(isPick,isForecolor){var selectedFunction ='getColor('+ isPick +','+ isForecolor +')'; csInterface.evalScript(...
javascript photoshop photoshop-script
1个回答
0
投票
嗯,这是解决方法...
© www.soinside.com 2019 - 2024. All rights reserved.