// 2015, use it at your own risk;
#target photoshop
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var docDesc = executeActionGet(ref);
var point = docDesc.getList(stringIDToTypeID("points"));
var p1 = [point.getObjectValue(1).getUnitDoubleValue(stringIDToTypeID("x")), point.getObjectValue(1).getUnitDoubleValue(stringIDToTypeID("y"))];
var p2 = [point.getObjectValue(2).getUnitDoubleValue(stringIDToTypeID("x")), point.getObjectValue(2).getUnitDoubleValue(stringIDToTypeID("y"))];
var angle = 360- getAngle (p1, p2);
alert (angle);
////// get an angle, 3:00 being 0˚, 6:00 90˚, etc. //////
function getAngle (pointOne, pointTwo) {
// calculate the triangle sides;
var width = pointTwo[0] - pointOne[0];
var height = pointTwo[1] - pointOne[1];
var sideC = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
// calculate the angles;
if (width+width > width) {theAngle = Math.asin(height / sideC) * 360 / 2 / Math.PI}
else {theAngle = 180 - (Math.asin(height / sideC) * 360 / 2 / Math.PI)};
if (theAngle < 0) {theAngle = (360 + theAngle)};
return theAngle
};