Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //Calculate length and width based on the rectangular bounds of the selected layer
  2. var length = layer.bounds[2]-layer.bounds[0]; //Grab the length
  3. var width = layer.bounds[3]-layer.bounds[1]; //Grab the width
  4.  
  5. //Create a text layer
  6. var textLayer = activeDocument.artLayers.add(); //Make a new layer on the canvas
  7. textLayer.kind = LayerKind.TEXT; //Make that layer a text layer
  8. textLayer.name = "Dimensions"; //Name the layer "Dimensions"
  9. var textReference = textLayer.textItem; //Create a textItem which we'll use to fill the text layer
  10. textReference.contents = "" + length + " * " + width; //Set the contents of that textItem to the length and width
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement