Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarshySwamp/34203050a4b2cabb4fcfe03ef5b456ba to your computer and use it in GitHub Desktop.
Save MarshySwamp/34203050a4b2cabb4fcfe03ef5b456ba to your computer and use it in GitHub Desktop.
Code Snippet: Remove ' px' from document width and height
// Remove ' px' from document width and height
app.preferences.rulerUnits = Units.PIXELS;
var w = app.activeDocument.width.toString().replace(' px', '');
var h = app.activeDocument.height.toString().replace(' px', '');
//or
var w = app.activeDocument.width.value;
var h = app.activeDocument.height.value;
//or
var w = (Number(activeDocument.width));
var h = (Number(activeDocument.height));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment