Add suffix to $Name — what should my stamp look like?

Easy one. Please help.

Add suffix to $Name — what should my stamp look like




Tip. If new to this sort of string (text) creation, do pay close attention to the whitespace at the join. It is easy to read @PaulWalters’s correct [sic] code above:

$Name=$Name + " SUFFIX";

but then actually type into our own document:

$Name=$Name + "SUFFIX";

Easily done, but now a necessary space character is gone. First point is that Tinderbox doesn’t insert a space for us, it assumes we the user will do that. Such coding slips are easily fixed but it reminds me that some care is needed if we aren’t using literal text (quote-enclosed “text”) for the suffix, i.e unlike the above. This is because in some contexts Tinderbox, behind the scenes, helpfully ‘trims’ leading whitespace from strings stored in attributes—and no, I don’t have list of such contexts.

So if doing this task with text stored in an attribute, I’d manage the joining whitespace (i.e. leading/trailing spaces) separately. So, if we have our suffix data stored:

$MyString = "SUFFIX";

then our stamp becomes:

$Name = $Name + " " + $MyString;

A little more code but no room for error as to intent (as signalled to Tinderbox via the code). The same for variables. so, if we’d stored the suffix text in a variable vSuffix the stamp would be:

$Name = $Name + " " + vSuffix;

Neither of these latter examples invalidate the original answer above. They simply explore some considerations when using literal strings (i.e. quote-enclosed text) vs attributes or variables. When using a stamp, we are often seeing the result on screen immediately. But, if we stamp 100 notes and perhaps change something not visible on screen (or in Displayed Attributes) then errors pass unseen.


The reply from @mwra is the correct approach; mine was sloppy.

1 Like

Not really! It gets us moving and solved the OP’s immediate problem.

For those that don’t use automation (seemingly a fair few) then my additional observations are moot. :slight_smile: