mirror of
https://github.com/sbrow/ps.git
synced 2026-02-27 02:51:44 -05:00
Got text working.
This commit is contained in:
@@ -10,10 +10,15 @@ function layers(lyrs) {
|
||||
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 + '}').replace(/ px/g, ""));
|
||||
if (i+1 != lyrs.length)
|
||||
stdout.write(',');
|
||||
stdout.writeln();
|
||||
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)
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
var stdout = newFile(arguments[0]);
|
||||
var lyr = eval(arguments[1]);
|
||||
stdout.writeln(('{"Name":"' + lyr.name + '","Bounds":[[' + lyr.bounds[0] + ',' +
|
||||
stdout.write(('{"Name":"' + lyr.name + '","Bounds":[[' + lyr.bounds[0] + ',' +
|
||||
lyr.bounds[1] + '],[' + lyr.bounds[2] + ',' +
|
||||
lyr.bounds[3] + ']],"Visible":' + lyr.visible + '}').replace(/ px/g, ""));
|
||||
lyr.bounds[3] + ']],"Visible":' + lyr.visible+',"Text":').replace(/ px/g, ""));
|
||||
if (lyr.kind == LayerKind.TEXT) {
|
||||
stdout.write('"'+lyr.textItem.contents.replace(/\r/g, "\\r")+'"');
|
||||
}
|
||||
else
|
||||
stdout.write(null)
|
||||
stdout.writeln('}')
|
||||
stdout.close();
|
||||
@@ -7,7 +7,12 @@ for (var i = 0; i < set.artLayers.length; i++) {
|
||||
var lyr = set.artLayers[i];
|
||||
stdout.write(('{"Name":"' + lyr.name + '", "Bounds": [[' + lyr.bounds[0] + ',' +
|
||||
lyr.bounds[1] + '],[' + lyr.bounds[2] + ',' +
|
||||
lyr.bounds[3] + ']], "Visible": ' + lyr.visible + '}').replace(/ px/g, ""));
|
||||
lyr.bounds[3] + ']], "Visible": ' + lyr.visible + ',"Text":').replace(/ px/g, ""));
|
||||
if (lyr.kind == LayerKind.TEXT)
|
||||
stdout.write('"'+lyr.textItem.contents.replace(/\r/g, "\\r")+'"');
|
||||
else
|
||||
stdout.write("null");
|
||||
stdout.write("}")
|
||||
if (i != set.artLayers.length - 1)
|
||||
stdout.writeln(",");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user