如何在Adobe Extension Builder 3中替换jsx文件

时间:2017-02-12 03:24:34

标签: javascript photoshop jsx photoshop-script

安装eclipse并处理扩展后,我有一个名为photoshop.jsx的文件。

$._ext_PHXS={
    run : function() {

        /**********  Replace below sample code with your own JSX code  **********/
        var appName;   
        appName = "Hello Photoshop";   
        alert(appName);
        /************************************************************************/

        return appName;
    },
};

当我用自己的JSX代码替换代码时,它无效。有什么问题?

$._ext_PHXS={
 
cTID = function(s) {
    return app.charIDToTypeID(s);
};
sTID = function(s) {
    return app.stringIDToTypeID(s);
};
 
 
function step1(enabled, withDialog) {
    if (enabled != undefined && !enabled)
        return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(cTID('Clr '), cTID('FrgC'));
    desc1.putReference(cTID('null'), ref1);
    var desc2 = new ActionDescriptor();
    desc2.putDouble(cTID('Rd  '), 187.996108949416);
    desc2.putDouble(cTID('Grn '), 125.003891050584);
    desc2.putDouble(cTID('Bl  '), 94);
    desc1.putObject(cTID('T   '), sTID("RGBColor"), desc2);
    desc1.putString(cTID('Srce'), "eyeDropperSample");
    executeAction(cTID('setd'), desc1, dialogMode);
};
step1();      // Set

0 个答案:

没有答案