Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #target photoshop;
- main();
- function main(){
- var ref = new ActionReference();
- ref.putProperty(charIDToTypeID('Prpr'),stringIDToTypeID("countClass"));
- ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
- var Count = executeActionGet(ref).getList(stringIDToTypeID("countClass")).count
- for(var z =0; z < Count; z++){
- var X = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID( "x" ));
- var Y = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID( "y" ));
- var layerName = "Count " + (z+1);
- logInfo(X + "," + Y)
- //createXY(layerName,X,Y,z);
- }
- };
- function createXY(layerName,X,Y,z) {
- var startRulerUnits = app.preferences.rulerUnits;
- app.preferences.rulerUnits = Units.PIXELS;
- var thisLayer = activeDocument.artLayers.add();
- thisLayer.kind = LayerKind.TEXT;
- thisLayer.name = layerName;
- var textProperty = thisLayer.textItem;
- textProperty.kind = TextType.POINTTEXT;
- //Font Size
- textProperty.size = 72;
- textProperty.font = "Arial";
- var newColor = new SolidColor();
- //Font Colour
- newColor.rgb.red = 19;
- newColor.rgb.green = 246;
- newColor.rgb.blue = 179;
- textProperty.color = newColor;
- textProperty.position = new Array( X,Y);
- thisLayer.blendMode = BlendMode.NORMAL;
- thisLayer.opacity = 100;
- textProperty.contents = "."+(z+1);
- app.preferences.rulerUnits=startRulerUnits;
- };
- function logInfo(Txt){
- var file = new File(Folder.desktop + "/ScriptLog.txt");
- file.open("e", "TEXT", "????");
- file.seek(0,2);
- $.os.search(/windows/i) != -1 ? file.lineFeed = 'windows' : file.lineFeed = 'macintosh';
- file.writeln(Txt);
- file.close();
- };
Add Comment
Please, Sign In to add comment