使用 AppleScript 在 Photoshop 中获取图层或选区的高度

Get Height of layer or selection in Photoshop with AppleScript

我在尝试使用 AppleScript 在 Photoshop 中获取图层高度或图层选区时遇到了很多麻烦。我的最终目标是获得 A 层的高度,然后是 B 层的高度,然后找出差异。它是一个更大的脚本的一部分,但我没有做或搜索似乎没有任何答案。

提前感谢您的帮助!

tell application "Adobe Photoshop CC 2015.5"  -- replace with the version of Photoshop you have
    activate
    set theDimensions to bounds of current layer of document 1
    set theWidth to item 3 of theDimensions
    set theHeight to item 4 of theDimensions
    set theDimensions to theWidth & theHeight
end tell

我在我的 Photoshop 文档中使用英寸作为测量单位,因此此脚本 return在结果中使用英寸作为值。我假设如果您使用像素或其他...此脚本将 return 适当的值

如果您不需要此脚本中的宽度值,只需将它们注释掉

这里是身高版本

tell application "Adobe Photoshop CC 2015.5"  -- replace with the version of Photoshop you have
    activate
    set theDimensions to bounds of current layer of document 1
    --set theWidth to item 3 of theDimensions
    set theHeight to item 4 of theDimensions
    --set theDimensions to theWidth & theHeight
end tell