Stamp to change border width and other note settings

I would be grateful please if someone could provide sample action code to put in a stamp that will apply a prototype to the selected note, AND change the particular note’s border to bright red, AND set the width of that bright red boarder to “broad”, AND change the text size to “shrink to fit”. Cheers, JR

Perhaps this doesn’t apply in your situation, but I’d suggest using your prototype to make the changes. Set your prototype’s border to red, the width to broad, then assign that prototype and the changes are assigned exactly as they would be with a stamp with one major difference.

If you set the color and border size of a note with a stamp, then those values become intrinsic to the note and in the future must be specifically changed. (They won’t inherit changes anymore from prototypes.) However, if you set these attributes with a prototype, the notes continue to use default/inherited values which makes it easy to change them in the future by assigning or changing a prototype.

If you have a note that already has an intrinsic value that isn’t inheriting from its prototypes, the easy way to reset the attributes is with a stamp that uses the attribute name followed by “=;” For example, to reset the color of a note, the stamps would read:

$Color=;

Ok, there are 4 tasks here:

  • Apply a $Prototype value [name not given]
  • Set $BorderColor to a value of ‘bright red’
  • Set $Border width to ‘broad’, i.e. a value of 4.
  • Apply a note size transform of ‘shrink to fit’.

Of these four only the first three can be applied using a stamp, i.e. via action code. The last must be applied via the app menu or a custom shortcut (as discussed in a separate thread).

I’ll assume the prototype is called ‘pProject’. The stamp would then be:

$Prototype = "pProject";
$BorderColor = "bright red";
$Border = 4;

Note that string values are enclosed in straight quotes. $Border takes a number-type value so quotes are not used.

A more efficient way to do this may be to set the $BorderColor and $Border in the prototype and simply use this stamp:

$Prototype = "pProject";

That way if you need to change these setting for multiple notes you just edit the prototype’s values. But note, if you’ve been experimenting with $BorderColor and $Border in notes before you apply the stamp, you will need to reset inheritance for those attribute(s) in those note(s). See more on inheritance in Tinderbox.

Thanks Mark. Extremely helpful as always. Much appreciated. Cheers, J