Copy link to clipboard
Copied
Is there a function I call call to convert between units in Extendscript? If not, what are the conversion factors Indesign uses to convert between units?
Hi Ben,
well, yes, look into UnitValue:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#UnitValue.html
Also see:
https://www.indiscripts.com/post/2016/01/indesign-scripting-forum-roundup-9#hd2sb4
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Ben,
well, yes, look into UnitValue:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#UnitValue.html
Also see:
https://www.indiscripts.com/post/2016/01/indesign-scripting-forum-roundup-9#hd2sb4
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe, thanks for the mention 😉
FYI, additional details and code tricks on UnitValue are exposed in IdExtenso's $$.Unit module:
https://github.com/indiscripts/IdExtenso/blob/master/etc/%24%24.Unit.jsxlib
Best,
Marc
Copy link to clipboard
Copied
Hi Ben, if by units you mean ruler units, you can also set the measurement units used by the script via app.scriptPreferences. I used this in response to your other post about setting a line’s length—without setting the scriptPreference, the length of the line you add would change depending on the user’s ruler settings
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;