Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// http://armand.eu/blog/working-with-measurement-units-in-adobe-extendscript/
function changeUnitsToPixels(){
if(typeof originalUnitsH === 'undefined') originalUnitsH = app.documents[0].viewPreferences.horizontalMeasurementUnits;
if(typeof originalUnitsV === 'undefined') originalUnitsV = app.documents[0].viewPreferences.verticalMeasurementUnits;
app.documents[0].viewPreferences.horizontalMeasurementUnits = app.documents[0].viewPreferences.verticalMeasurementUnits = MeasurementUnits.pixels;
}
function changeUnitsBack(){
app.documents[0].viewPreferences.horizontalMeasurementUnits = originalUnitsH;
app.documents[0].viewPreferences.verticalMeasurementUnits = originalUnitsV;
delete originalUnitsH;
delete originalUnitsV;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment