The setAttribute function in this script addresses an issue where specified text attributes are ignored when their values match the default values of the applied character or paragraph styles.
Since writing workaround scripts every time someone ran into this issue became tedious, I created this as a more generalized solution that reliably applies all text attributes.