adobe-uxp / ps-es-to-uxp

An ExtendScript utility to help transform your code to batchPlay
22 stars 2 forks source link

Error Converting ES / AM Code with `SETD` #3

Open FixelAlgorithms opened 3 years ago

FixelAlgorithms commented 3 years ago

I have the following Temp.jsx file:

var mainScriptPath = Folder($.fileName).parent.parent ;
var scriptFile = new File(mainScriptPath + '/ad-to-uxp.jsx')
$.evalFile(scriptFile);

cTID = charIDToTypeID;
sTID = stringIDToTypeID;

function s2t(s) {return app.stringIDToTypeID(s);}
function c2t(c) {return app.charIDToTypeID(c);}

var dialogMode = DialogModes.NO

// executeActionForUXP

var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(c2t("Chnl"), s2t("selection"));
desc1.putReference(c2t("null"), ref1);
desc1.putEnumerated(c2t("T   "), c2t("Ordn"), c2t("Al  "));
executeActionForUXP(c2t("setd"), desc1, dialogMode);

It seems it can't be proceed and generates the following error:

image

FixelAlgorithms commented 3 years ago

@baaygun, any idea about this?

baaygun commented 3 years ago

Hi @FixelAlgorithms , this is a valid case of an action reference that I haven't accounted for in my script. I will update the script by next week to make sure it can handle these cases, and we're tracking this internally.

In this case, the valid JSON would be:

{
    "_obj": "set",
    "_target": [
        {
            "_property": "selection",
            "_ref": "channel"
        }
    ],
    "to": {
        "_enum": "ordinal",
        "_value": "allEnum"
    }
}
baaygun commented 3 years ago

I will keep the issue open until the script itself is fixed.

FixelAlgorithms commented 3 years ago

While you're on the roll there 2 more patterns we have found, so far, that doesn't work:

var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(c2t("Clr "), c2t("Clrs"));
desc1.putReference(c2t("null"), ref1);
executeActionForUXP(c2t("Rset"), desc1, dialogMode);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(c2t("Clr "), c2t("Clrs"));
desc1.putReference(c2t("null"), ref1);
executeActionForUXP(c2t("Exch"), desc1, dialogMode);
FixelAlgorithms commented 3 years ago

Another one is related to Apply Image where the script ignores the putName() command:

var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(c2t("Chnl"), c2t("Chnl"), s2t("RGB"));
ref1.putName(c2t("Lyr "), "Star suppression");
desc2.putReference(c2t("T   "), ref1);
desc2.putBoolean(c2t("Invr"), true);
desc2.putEnumerated(c2t("Clcl"), c2t("Clcn"), c2t("Add "));
desc2.putDouble(c2t("Scl "), 1);
desc2.putInteger(c2t("Ofst"), 0);
desc2.putBoolean(c2t("PrsT"), true);
desc1.putObject(c2t("With"), c2t("Clcl"), desc2);
executeActionForUXP(s2t("applyImageEvent"), desc1, dialogMode);

The same just with Slct:

var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(c2t("Chnl"), c2t("Chnl"), c2t("Msk "));
ref1.putName(c2t("Lyr "), "Star suppression");
desc1.putReference(c2t("null"), ref1);
desc1.putBoolean(c2t("MkVs"), false);
executeActionForUXP(c2t("slct"), desc1, dialogMode);

You can observe the output ignores the putName() command.

DennyOl commented 1 year ago

Hello, I'm currently working on the porting of a MASSIVE CEP panel to UXP, and without having the original .atn files, this script was my last hope to be able to do it. I've encountered few translation issues from ExtendScript commands into batchPlay ones just like mentioned above from @FixelAlgorithms. Is this script going to get some fixes anytime soon?