Copy link to clipboard
Copied
A photoshop document has multiple active selections on the canvas.
A square selection, around selection, and irregular selection for example.
Is it possible to alert the number of active selections at a given time?
function slctns() {
return sTT = stringIDToTypeID,
aHS = (aD = activeDocument).activeHistoryState,
(ref1 = new ActionReference()).putClass(sTT('path')),
(dsc = new ActionDescriptor()).putReference(sTT('null'), ref1),
(ref2 = new ActionReference()).putProperty(sTT('selectionClass'), sTT('selection')),
dsc.putReference(sTT('from'), ref2), dsc.putUnitDouble(sTT('tolerance'), sTT('pixelsUnit'), .5),
executeAction(sTT('make'), dsc), lngth = aD.pathItems[0].subPathItems.length, aD.activeHistory
...
Copy link to clipboard
Copied
We knew what your were after. I was just pointing out that your concept that Photoshop has multiple Active selection is not correct. What the code does is have Photoshop map the active selection that is create a path like contour line on a map the Path will have Path items that map each of the layer selected pixel areas. A selection is a singular thing its a map. You can have many saved selections there is only one active selection you have it or to don't and can be changed/modified.
Copy link to clipboard
Copied
From last few requests I learnt users can't describe what they want, so they often mislead unintentionally. Knowing that I try to guess what the logic is covered below their "image".
Copy link to clipboard
Copied
var file = new File(Folder.temp.fsName + "/" + "tmp");
var d = new ActionDescriptor();
executeAction(stringIDToTypeID("deleteMeasurements"), d, DialogModes.NO);
var d = new ActionDescriptor();
d.putEnumerated(stringIDToTypeID("source"), stringIDToTypeID("measurementSource"), stringIDToTypeID("selection"));
var list = new ActionList();
list.putEnumerated(stringIDToTypeID("measurementDataPoint"), stringIDToTypeID("Count"));
d.putList(stringIDToTypeID("dataPoints"), list);
var d = executeAction(stringIDToTypeID("recordMeasurements"), d, DialogModes.NO);
var d = new ActionDescriptor();
d.putPath(stringIDToTypeID("file"), file);
executeAction(stringIDToTypeID("exportMeasurements"), d, DialogModes.NO);
var d = new ActionDescriptor();
executeAction(stringIDToTypeID("deleteMeasurements"), d, DialogModes.NO);
file.open("r");
var s = file.read();
file.close();
file.remove();
alert(s);