javieraroche / descriptor-info Goto Github PK
View Code? Open in Web Editor NEWJSX module to recursively get all the properties in an ActionDescriptor used in Adobe applications
License: MIT License
JSX module to recursively get all the properties in an ActionDescriptor used in Adobe applications
License: MIT License
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref)
var convertDesc = new ActionDescriptor();
convertDesc.putObject( stringIDToTypeID("object"), stringIDToTypeID("object"), desc );
var jsonDesc = executeAction( stringIDToTypeID("convertJSONdescriptor"), convertDesc, DialogModes.NO );
jsonDesc.getString(stringIDToTypeID("json") );
Limit the max number of characters in the XMPMetadataAsUTF8 string. This is especially problematic if the comp has 10000+ lines of metadata.
I have JSON arguments listener based on this tool and I noticed some strange behavior.
When worked in Photoshop, there was a lag. My .log file jumped from 150Kb size to 68MB size.
I saw that there was 25 000 000 characters in "Raw data type" value.
Photoshop then began acting strangely.
I'm not sure exactly what happened. But I think we could reduce the length of the value to 10 000 characters by default. And if we want more then we would use the flag.
If it occurs again, I will tell you.
It can't read all data from new guideline event in CC2014
Just for info.
"application": "C:\Program Files\Adobe\Adobe Photoshop CC 2015 (16.1.2)"
"date": "Saturday, April 02 2016 23:59:40"
"messedUpIDs":
{
"'Algn'":
[
"align",
"alignment"
],
"'AntA'":
[
"antiAlias",
"antiAliasedPICTAcquire"
],
"'BckL'":
[
"backgroundLayer",
"backgroundLevel"
],
"'BlcG'":
[
"blackGenerationType",
"blackGenerationCurve"
],
"'BlcL'":
[
"blackLevel",
"blackLimit"
],
"'Blks'":
[
"blacks",
"blocks"
],
"'BlrM'":
[
"blurMethod",
"blurMore"
],
"'BrgC'":
[
"brightnessEvent",
"brightnessContrast"
],
"'BrsD'":
[
"brushDetail",
"brushesDefine"
],
"'Brsh'":
[
"brush",
"brushes"
],
"'Clcl'":
[
"calculation",
"calculations"
],
"'ClrP'":
[
"colorPalette",
"coloredPencil"
],
"'Cnst'":
[
"constant",
"constrain"
],
"'CntC'":
[
"centerCropMarks",
"conteCrayon"
],
"'Cntr'":
[
"center",
"contrast"
],
"'CrtD'":
[
"createDroplet",
"createDuplicate"
],
"'CstP'":
[
"customPalette",
"customPhosphors"
],
"'Cstm'":
[
"custom",
"customPattern"
],
"'Drkn'":
[
"darken",
"darkness"
],
"'Dstr'":
[
"distort",
"distortion",
"distribute",
"distribution"
],
"'Dstt'":
[
"desaturate",
"destWhiteMax"
],
"'FlIn'":
[
"fileInfo",
"fillInverse"
],
"'Gd '":
[
"good",
"guide"
],
"'GnrP'":
[
"generalPreferences",
"generalPrefs",
"preferencesClass"
],
"'GrSt'":
[
"grainStippled",
"graySetup"
],
"'Grdn'":
[
"gradientClassEvent",
"gridMinor"
],
"'Grn '":
[
"grain",
"green"
],
"'Grns'":
[
"graininess",
"greens"
],
"'HstP'":
[
"historyPreferences",
"historyPrefs"
],
"'HstS'":
[
"historyState",
"historyStateSourceType"
],
"'ImgP'":
[
"imageCachePreferences",
"imagePoint"
],
"'In '":
[
"in",
"stampIn"
],
"'IntW'":
[
"interfaceWhite",
"intersectWith"
],
"'Intr'":
[
"interfaceIconFrameDimmed",
"interlace",
"interpolation",
"intersect"
],
"'JPEG'":
[
"JPEG",
"JPEGFormat"
],
"'LghD'":
[
"lightDirection",
"lightDirectional"
],
"'LghO'":
[
"lightOmni",
"lightenOnly"
],
"'LghS'":
[
"lightSource",
"lightSpot"
],
"'Lns '":
[
"lens",
"lines"
],
"'Mgnt'":
[
"magenta",
"magentas"
],
"'Mxm '":
[
"maximum",
"maximumQuality"
],
"'NTSC'":
[
"NTSC",
"NTSCColors"
],
"'NmbL'":
[
"numberOfLayers",
"numberOfLevels"
],
"'PlgP'":
[
"pluginPicker",
"pluginPrefs"
],
"'Pncl'":
[
"pencilEraser",
"pencilWidth"
],
"'Pnt '":
[
"paint",
"point"
],
"'Prsp'":
[
"perspective",
"perspectiveIndex"
],
"'PrvM'":
[
"previewMacThumbnail",
"previewMagenta"
],
"'Pstr'":
[
"posterization",
"posterize"
],
"'RGBS'":
[
"RGBSetup",
"RGBSetupSource"
],
"'Rds '":
[
"radius",
"reds"
],
"'ScrD'":
[
"scratchDisks",
"screenDot"
],
"'ShdI'":
[
"shadingIntensity",
"shadowIntensity"
],
"'ShpC'":
[
"shapeCurveType",
"shapingCurve"
],
"'ShrE'":
[
"sharpenEdges",
"shearEd"
],
"'Shrp'":
[
"sharpen",
"sharpness"
],
"'SplC'":
[
"splitChannels",
"supplementalCategories"
],
"'Spot'":
[
"spot",
"spotColor"
],
"'SprS'":
[
"separationSetup",
"sprayedStrokes"
],
"'StrL'":
[
"strokeLength",
"strokeLocation"
],
"'Strt'":
[
"saturation",
"start"
],
"'TEXT'":
[
"char",
"textType"
],
"'TIFF'":
[
"TIFF",
"TIFFFormat"
],
"'TglO'":
[
"toggleOptionsPalette",
"toggleOthers"
],
"'TrnG'":
[
"transparencyGamutPreferences",
"transparencyGrid",
"transparencyGridSize"
],
"'TrnS'":
[
"transferSpec",
"transparencyShape",
"transparencyStop"
],
"'Trns'":
[
"transparency",
"transparent"
],
"'TxtC'":
[
"textClickPoint",
"textureCoverage"
],
"'TxtF'":
[
"textureFile",
"textureFill"
],
"'UsrM'":
[
"userMaskEnabled",
"userMaskOptions"
],
"'c@#^'":
[
"inherits",
"pInherits"
],
"'comp'":
[
"comp",
"sInt64"
],
"'doub'":
[
"floatType",
"IEEE64BitFloatingPoint",
"longFloat"
],
"'long'":
[
"integer",
"longInteger",
"sInt32"
],
"'magn'":
[
"magnitude",
"uInt32"
],
"'null'":
[
"null",
"target"
],
"'shor'":
[
"sInt16",
"sMInt",
"shortInteger"
],
"'sing'":
[
"IEEE32BitFloatingPoint",
"sMFloat",
"shortFloat"
]
}
Script gets stuck when analyzing 3D layer. Probably because there is huge amount of data or maybe very long RAW value somewhere.
The script does not work on Ps 22.4 anymore. Even the simplest ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
produces "Internal error (require failed)".
descStringID = typeIDToStringID( list.getClass(ii) );
is the line producing the error. Any advice?
this line:
descProperties.reference = executeActionGet( descProperties.value );
fails quite offten, but you can't see it because it is in try{} block.
There is some more info you can get from action reference no matter if problematic line works or not.
I am using your tool for events analyzing. And structure is very similar to ScriptListener code except action references. The benefit is that I don't need read from disk and parse text file. And I also can access values like:
if(desc.to.fontCaps == "normal") {//do something}
And with extended info, I could run same event again with a bit different parameter value. If I could write code which can rebuild Action Descriptor like JAM framework.
Non-extended for arguments[0]
{
"null": {
"typename": "ActionReference"
},
"to": {
"textOverrideFeatureName": 808465713,
"typeStyleOperationType": 3,
"fontCaps": "normal"
}
}
arguments[1]
contains eventID "setD"
Extended
{
"null": {
"stringID": "null",
"charID": "null",
"id": 1853189228,
"key": 0,
"type": "DescValueType.REFERENCETYPE",
"value": {
"typename": "ActionReference"
}
},
"to": {
"stringID": "to",
"charID": "T ",
"id": 1411391520,
"key": 1,
"type": "DescValueType.OBJECTTYPE",
"value": {
"count": 3,
"typename": "ActionDescriptor"
},
"object": {
"textOverrideFeatureName": {
"stringID": "textOverrideFeatureName",
"charID": "",
"id": 3837,
"key": 0,
"type": "DescValueType.INTEGERTYPE",
"value": 808465713
},
"typeStyleOperationType": {
"stringID": "typeStyleOperationType",
"charID": "",
"id": 1366,
"key": 1,
"type": "DescValueType.INTEGERTYPE",
"value": 3
},
"fontCaps": {
"stringID": "fontCaps",
"charID": "",
"id": 1329,
"key": 2,
"type": "DescValueType.ENUMERATEDTYPE",
"value": "allCaps",
"enumerationType": "fontCaps"
}
}
}
}
Script Listener
var idsetd = charIDToTypeID( "setd" );
var desc1952 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref582 = new ActionReference();
var idPrpr = charIDToTypeID( "Prpr" );
var idTxtS = charIDToTypeID( "TxtS" );
ref582.putProperty( idPrpr, idTxtS );
var idTxLr = charIDToTypeID( "TxLr" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref582.putEnumerated( idTxLr, idOrdn, idTrgt );
desc1952.putReference( idnull, ref582 );
var idT = charIDToTypeID( "T " );
var desc1953 = new ActionDescriptor();
var idtextOverrideFeatureName = stringIDToTypeID( "textOverrideFeatureName" );
desc1953.putInteger( idtextOverrideFeatureName, 808465713 );
var idtypeStyleOperationType = stringIDToTypeID( "typeStyleOperationType" );
desc1953.putInteger( idtypeStyleOperationType, 3 );
var idfontCaps = stringIDToTypeID( "fontCaps" );
var idfontCaps = stringIDToTypeID( "fontCaps" );
var idallCaps = stringIDToTypeID( "allCaps" );
desc1953.putEnumerated( idfontCaps, idfontCaps, idallCaps );
var idTxtS = charIDToTypeID( "TxtS" );
desc1952.putObject( idT, idTxtS, desc1953 );
executeAction( idsetd, desc1952, DialogModes.NO );
This line creates error in DescriptorInfo.prototype._getDescList:
typeIDToStringID( list.getClass(ii) )
My temporary fix
try{
descStringID = typeIDToStringID( list.getClass(ii) );
}catch(e){
descStringID = "error_descriptor-info";
}
Problem occurs if you apply wrap/deformation on smart object
"customEnvelopeWarp": {
"meshPoints": [
{
"error_descriptor-info": {
"horizontal": 0,
"vertical": 0
}
},
{
"error_descriptor-info": {
"horizontal": 319,
"vertical": 0
}
},
{
"error_descriptor-info": {
"horizontal": 638,
"vertical": 0
}
},
{
"error_descriptor-info": {
"horizontal": 957,
"vertical": 0
}
},
{
"error_descriptor-info": {
"horizontal": 0,
"vertical": 214.333333333333
}
},
{
"error_descriptor-info": {
"horizontal": 319,
"vertical": 214.333333333333
}
},
{
"error_descriptor-info": {
"horizontal": 638,
"vertical": 214.333333333333
}
},
{
"error_descriptor-info": {
"horizontal": 957,
"vertical": 214.333333333333
}
},
{
"error_descriptor-info": {
"horizontal": 0,
"vertical": 428.666666666667
}
},
{
"error_descriptor-info": {
"horizontal": 319,
"vertical": 428.666666666667
}
},
{
"error_descriptor-info": {
"horizontal": 638,
"vertical": 428.666666666667
}
},
{
"error_descriptor-info": {
"horizontal": 957,
"vertical": 428.666666666667
}
},
{
"error_descriptor-info": {
"horizontal": 0,
"vertical": 643
}
},
{
"error_descriptor-info": {
"horizontal": 319,
"vertical": 643
}
},
{
"error_descriptor-info": {
"horizontal": 638,
"vertical": 643
}
},
{
"error_descriptor-info": {
"horizontal": 957,
"vertical": 643
}
}
]
}
In JAM action manager from TonTon it looks like this:
"customEnvelopeWarp":
{
"<object>":
{
"customEnvelopeWarp":
{
"meshPoints":
{
"<list>":
[
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 980
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 373
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1106.66666666667
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 373
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1233.33333333333
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 373
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1360
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 373
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 980
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 437
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1106.66666666667
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 437
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1233.33333333333
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 437
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1360
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 437
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 980
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 501
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1106.66666666667
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 501
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1233.33333333333
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 501
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1360
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 501
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 980
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 565
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1106.66666666667
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 565
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1233.33333333333
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 565
}
}
}
}
},
{
"<object>":
{
"rationalPoint":
{
"horizontal":
{
"<unitDouble>":
{
"pixelsUnit": 1360
}
},
"vertical":
{
"<unitDouble>":
{
"pixelsUnit": 565
}
}
}
}
}
]
}
}
}
}
There are two double(decimal) types:
Example: var strokeDoubleType = desc.getUnitDoubleType(stringIDToTypeID('strokeStyleLineWidth'));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.