Tinderbox Forum

Use Action Code to Change the Name of Adornments

Is there a way to use action code to change name of adornments? I can’t seem to use an agent or the attribute browser to see adornments, which would be my preferred way to do this.

1 Like

Agents don’t, by design, match adornments. Action code to the rescue, as this stamp will rename adornment “ZZ” to “YY”:


Yes, but this means I need to do it one at a time. I’d like to change multiple notes at once. I guess I can create an extensive conditional stamp. Also, how would you apply this stamp to multiple adornments that are locked?

Make a list of the adornments names: you can’t use action code for this as action code queries are blind to adornments—both agent queries and find()/collect()/etc filter out adornments.

I think there’s no ill will here, it was simply not envisaged that you would use action code for this.Plus, as adornments are map-only visual elements generally they aren’t pertinent in queries.FWIW, I don’t think adornments export to HTML either.

Once you’ve made your list (use grep in BBEdit on the source XML if needs be) you can then iterate it.

However, my code above shows that whilst you can’t query for adornments’ names, if you know them you can act on the adornment using an offset attribute reference.

I think the take-away from this is that if making a complex map with 00s of adornments (here a conference schedule) using lots of copy/paste, it makes sense to first consider how to equip them with sufficient metadata to enable self-renaming, and/or making a list of adornment names as you create them.

As query/find don’t currently match adornments, being able to find them would require a new feature as changing existing behaviours could break the functioning of code in existing TBXs should previously excluded adornments now show up in their queries.

The XML modification trick worked great! Have made some requests on backstage.

1 Like