Attribute values
Set the value of an attribute, here $Width:
set value of attribute "Width" of myNote to 5
Note the AppleScript limitation of the (implicit use of the) named operator and its case-insensitivity matching names. For setting a note's $Name, see here.
To get the value of a designated attribute:
get value of attribute "Width" of myNote
Or, for an offset address:
get value of attribute "Width" of (lastChild of MyNote)
Attributes with local values can be reported:
get the localattributes of MyNote
… returns a list of attributes for a note where (both):
- the note has an immediate value for that attribute, rather than inheriting a value from a prototype or the attribute default.
- the attribute is not intrinsic, hidden, or deprecated.
Getting and setting attribute values
This involves addressing the value of the attribute. To get (read) $Width
get value of attribute "Width" of myNote
or set it
set value of attribute "Width" of myNote to 5
If a value for an Number type is passed as a string, or vice versa, consider issues of auto-coercion.
Reading (or altering) attribute default values
The default value of an attribute can be read or set from the note [sic] context:
get defaultValue of attribute "Width" of myNote
or
set defaultValue of attribute "Width" of myNote to "5"
Resetting an attribute to its default
To remove any local value assigned to the designated attribute, restoring the inherited or default value:
delete value of attribute "Width" of myNote
This is akin to the action $Width=;.
Remember to refresh the UI!
If operating on a document actually being viewed it can be useful to refresh the UI (see refresh) to ensure the Tinderbox window reflects the changes made via scripting.
See also—notes linking to here: