Copy link to clipboard
Copied
This is driving me nuts:
When asking for a property of a textItem like baselineShift, and that property has not been manually set by the user before, it returns undefined even though it may have a default value, as evidenced in the Character properties panel. Is there a workaorund to this bug?
To replicate:
• Put a paragraph style textfield into your document
• Put in some text
• Do not change any of the default values
• alert(app.activeDocument.activeLayer.textItem.baselineShift)
[ result: undefinded]
• Now set the baseline shift in the properties panel to say 15
• alert(app.activeDocument.activeLayer.textItem.baselineShift)
[ result: 15 px]
Copy link to clipboard
Copied
You could wrap the code in a try-clause and return the default value on error.
Copy link to clipboard
Copied
True,and thanks for the workaround.
But so sad that Adobe is so sloppy about it and does not clean up their act or at least document these flaws.
Copy link to clipboard
Copied
When working with textItem properties it's good practice to always wrap access and have default value (and maybe user warnings), it can just blow up For example sometimes accessing justification gets in a bad state and only help is resetting the setting in UI.