mirror of
https://github.com/sbrow/ps.git
synced 2026-02-28 03:01:43 -05:00
Added a TextItem Struct to Artlayers.
* Converted scripts to use the same getLayers() function from lib.js
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user