﻿


// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop

// in case we double clicked the file
app.bringToFront();

var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.POINTS;

var docRef = app.activeDocument;
// suppress all dialogs
app.displayDialogs = DialogModes.NO;

var textColor = new SolidColor;
textColor.rgb.red = cred;
textColor.rgb.green = cgreen;
textColor.rgb.blue = cblue;

newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = textString;


newTextLayer.textItem.size = sizeOffon;
newTextLayer.textItem.color = textColor;
newTextLayer.textItem.font= fontFam;
newTextLayer.textItem.position = Array(x, y) ;
newTextLayer.textItem.fauxBold=isItBold;
newTextLayer.textItem.fauxItalic=isItItal;
newTextLayer.textItem.direction=isItVeritcal;

if (rotangle!==0) newTextLayer.rotate(rotangle, AnchorPosition.TOPLEFT);



app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;

//+newTextLayer.textItem.size*3/4

docRef = null;
textColor = null;
newTextLayer = null;

