Copier le lien dans le Presse-papiers
Copié
Hey
Running this :
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("AdjL"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var desc = executeActionGet(ref);
var data = desc.getList(stringIDToTypeID("adjustment")).getObjectValue(0).getData(stringIDToTypeID("legacyContentData"));
var Brightness= getShortIntFromData(data, 0),
var Contrast= getShortIntFromData(data, 2),
var UseLegacy= (getShortIntFromData(data, 4)) ? 1 : 0
If the bri&contrast is set to Use Legacy = I get all data
But if its "new" then I can't get any data no matter what I do.
Any idea, any1 ?
Regards
Dariusz
Try thia
function get_contrast_desc(id)
{
try {
var r = new ActionReference();
var d = new ActionDescriptor();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("json"));
r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
d.putInteger(stringIDToTypeID("layerID"), id);
d.putBoolean(stringIDToTypeID("layerInfo"), true);
...
Copier le lien dans le Presse-papiers
Copié
Try thia
function get_contrast_desc(id)
{
try {
var r = new ActionReference();
var d = new ActionDescriptor();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("json"));
r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
d.putInteger(stringIDToTypeID("layerID"), id);
d.putBoolean(stringIDToTypeID("layerInfo"), true);
d.putBoolean(stringIDToTypeID( "includeAncestors" ), false);
eval("var json="+executeAction(stringIDToTypeID("get"), d, DialogModes.NO).getString(stringIDToTypeID("json")));
var d = new ActionDescriptor();
if (!json.layers) return d;
if (json.layers.length != 1) return d;
if (json.layers[0].id != id) return d;
var adj = json.layers[0].adjustment;
if (!adj) return d;
if (adj.brightness != undefined) d.putInteger(stringIDToTypeID("brightness"), adj.brightness);
if (adj.center != undefined) d.putInteger(stringIDToTypeID("center"), adj.center);
if (adj.useLegacy != undefined) d.putBoolean(stringIDToTypeID("useLegacy"), adj.useLegacy);
return d;
}
catch (e) { throw(e); }
}
Copier le lien dans le Presse-papiers
Copié
This is incredible!
Also how? Why when what?!
Also if we can get data as json, can we also set data from json? O.O
Tell me more, I must know!!! O.O
Also,
Regards
Dariusz
Copier le lien dans le Presse-papiers
Copié
This is very interesting! I am using a script that I wrote myself few years ago which is reading the values from a levels layer using getData(stringIDToTypeID("legacyContentData")) which is not working anymore in PS 24.6 . I played with your function and json.layers[0].adjustment.brightness it really reads the value! But what are the new names for channel values for Levels adjustments layer? In my old scripts I was parsing something like Dariusz using getShortIntFromData
Best regards,
Alain
Trouvez plus d’idées, d’événements et de ressources dans la nouvelle communauté Adobe
Explorer maintenant