Copy link to clipboard
Copied
I'm writing a small javascript to automate file setup, and part of it needs to copy one section of the file onto another area. The second selection is dependent on the size of the file, so I did some simple addition to find the right location:
Does anyone know what could be causing this?
Using Photoshop 2023 on Mac OS Big Sur
Thanks!
Copy link to clipboard
Copied
Have you explicitly set inches as the required ruler units?
Copy link to clipboard
Copied
Yes, for both ruler and type.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Here's the most relevant pieces, just tested it myself on a 20x20 blank new file
Copy link to clipboard
Copied
app.preferences.rulerUnits = Units.INCHES
app.preferences.TypeUnits = Units.INCHES
fileWidth = app.activeDocument.width.value
alert(fileWidth)
prompt("This is the title (hint). The result is below the line.", -(fileWidth)+51.5)
prompt("This is the title (hint). The result is below the line.", 51.5-fileWidth)
Copy link to clipboard
Copied
Thanks!
Pulling the unitless value fixes the issue.
Still curious why the units would cause it in the first place...
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more