Facebook
From Artur Grabowski, 4 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 228
  1. var fullName = "Wojciech Zachwieja";
  2. var date = new Date();
  3. var d  = date.getDate();  
  4. var day = (d < 10) ? '0' + d : d;  
  5. var m = date.getMonth() + 1;  
  6. var month = (m < 10) ? '0' + m : m;  
  7. var yy = date.getYear();  
  8. var year = (yy < 1000) ? yy + 1900 : yy;  
  9. var content = fullName + " , " +  day + '-' + month + '-' + year;
  10.  
  11. createText(42, content)
  12. activeDocument.activeLayer.name = "Text";
  13. activeDocument.activeLayer.textItem.justification = Justification.CENTER;
  14.  
  15. function createText(size, content)
  16. {
  17.   // Add a new layer in the new document
  18.   var artLayerRef = app.activeDocument.artLayers.add();
  19.  
  20.   // Specify that the layer is a text layer
  21.   artLayerRef.kind = LayerKind.TEXT;
  22.  
  23.   //This section defines the color of the hello world text
  24. //  textColor = new SolidColor();
  25. //  textColor.rgb.red = 0;
  26. //  textColor.rgb.green = 0;
  27. //  textColor.rgb.blue = 0;
  28.  
  29.   //Get a reference to the text item so that we can add the text and format it a bit
  30.   textItemRef = artLayerRef.textItem
  31.   textItemRef.contents = content;
  32.  // textItemRef.color = textColor;
  33.  // textItemRef.size = size;
  34.  
  35.   textItemRef.position = new Array(15, 10); //pixels from the left, pixels from the top
  36. }
  37.  
  38.