Added a TextItem Struct to Artlayers.

* Converted scripts to use the same getLayers() function from lib.js
This commit is contained in:
Unknown
2018-04-26 13:09:36 -04:00
parent e136ea8a83
commit 40cde546bc
8 changed files with 179 additions and 85 deletions

View File

@@ -3,25 +3,8 @@ var stdout = newFile(arguments[0]);
var doc = app.activeDocument;
stdout.writeln(('{"Name": "'+doc.name+'", "Height":'+doc.height+
', "Width":'+doc.width+', "ArtLayers": [').replace(/ px/g, ""));
function layers(lyrs) {
if (typeof lyrs === 'undefined')
return;
for (var i = 0; i < lyrs.length; i++) {
var lyr = lyrs[i];
stdout.write(('{"Name":"' + lyr.name + '", "Bounds": [[' + lyr.bounds[0] + ',' +
lyr.bounds[1] + '],[' + lyr.bounds[2] + ',' +
lyr.bounds[3] + ']], "Visible": ' + lyr.visible+', "Text":').replace(/ px/g, ""));
if (lyr.kind == LayerKind.TEXT)
stdout.write('"'+lyr.textItem.contents+'"');
else
stdout.write("null");
stdout.write("}")
if (i+1 != lyrs.length)
stdout.write(',');
stdout.writeln();
}
}
layers(doc.artLayers)
stdout.writeln(layers(doc.artLayers))
stdout.writeln('], "LayerSets": [');
function lyrSets(sets, nm) {
if (typeof sets === 'undefined')