I’m not aware of any option to specify the unit of the returned value, but distance unit is essentially just factoring in the current resolution of your document (pixels/inch), relative to the standard resolution of 72ppi.
The formula is distance * ppi / 72
to convert it to pixels and pixels / ppi * 72
for the other way around.
So if your document is 100px wide at 144ppi, the width returned width will be 50 (distance units).
I’ve recently made my unit conversion functions available in a repo, maybe that helps.
Btw, you can tell batchPlay to only get a specific property, which will run faster than getting the whole document descriptor. There’s also multiGet to specify more than one property:
photoshop.action.batchPlay(
[
{
_obj: 'multiGet',
_target: { _ref: 'document', _enum: 'ordinal', _value: 'targetEnum' },
extendedReference: [['width', 'height', 'resolution']],
},
],
{ synchronousExecution: true }
)