Last active
July 11, 2022 13:39
-
-
Save MarshySwamp/34203050a4b2cabb4fcfe03ef5b456ba to your computer and use it in GitHub Desktop.
Code Snippet: Remove ' px' from document width and height
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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