Is there a function for converting units in Extendscript?

New Here ,
Apr 21, 2022 Apr 21, 2022

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?

TOPICS
How to , Scripting

Views

105

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Apr 21, 2022 Apr 21, 2022

Likes

Translate

Translate
Adobe Community Professional ,
Apr 21, 2022 Apr 21, 2022

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 21, 2022 Apr 21, 2022

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;

 

 

 

 

https://community.adobe.com/t5/indesign-discussions/how-to-call-for-graphic-line-length-using-extend...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines