Guest User

Untitled

a guest
Oct 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #target photoshop;
  2. main();
  3. function main(){
  4. var ref = new ActionReference();
  5. ref.putProperty(charIDToTypeID('Prpr'),stringIDToTypeID("countClass"));
  6. ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
  7. var Count = executeActionGet(ref).getList(stringIDToTypeID("countClass")).count
  8. for(var z =0; z < Count; z++){
  9. var X = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID( "x" ));
  10. var Y = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID( "y" ));
  11. var layerName = "Count " + (z+1);
  12. logInfo(X + "," + Y)
  13. //createXY(layerName,X,Y,z);
  14. }
  15. };
  16. function createXY(layerName,X,Y,z) {
  17. var startRulerUnits = app.preferences.rulerUnits;
  18. app.preferences.rulerUnits = Units.PIXELS;
  19. var thisLayer = activeDocument.artLayers.add();
  20. thisLayer.kind = LayerKind.TEXT;
  21. thisLayer.name = layerName;
  22. var textProperty = thisLayer.textItem;
  23. textProperty.kind = TextType.POINTTEXT;
  24. //Font Size
  25. textProperty.size = 72;
  26. textProperty.font = "Arial";
  27. var newColor = new SolidColor();
  28. //Font Colour
  29. newColor.rgb.red = 19;
  30. newColor.rgb.green = 246;
  31. newColor.rgb.blue = 179;
  32. textProperty.color = newColor;
  33. textProperty.position = new Array( X,Y);
  34. thisLayer.blendMode = BlendMode.NORMAL;
  35. thisLayer.opacity = 100;
  36. textProperty.contents = "."+(z+1);
  37. app.preferences.rulerUnits=startRulerUnits;
  38. };
  39.  
  40. function logInfo(Txt){
  41. var file = new File(Folder.desktop + "/ScriptLog.txt");
  42. file.open("e", "TEXT", "????");
  43. file.seek(0,2);
  44. $.os.search(/windows/i) != -1 ? file.lineFeed = 'windows' : file.lineFeed = 'macintosh';
  45. file.writeln(Txt);
  46. file.close();
  47. };
Add Comment
Please, Sign In to add comment