Reply To: Can I use a template to create/change contents of another

Product Compare Forums Multi-Edit Support Can I use a template to create/change contents of another Reply To: Can I use a template to create/change contents of another

#5210
ReidSweatman
Participant

If the value only need be persistent for the current session, the <-PROMPT~name> form of the template metacommand saves the value under a unique name constructed from whatever you gave as “name.”

If you need persistence between sessions, you’ll have to write a macro that displays the prompt and stores its return value in a persistent global, which you can run using the <!macro> template metacommand. After that, you can use the <~global_str> template metacommand in templates to insert the value of the saved global.

Anything more involved than that would entail some interesting surgery to the Template.s system macro file. That’s doable, but you’d want to have a really good grasp of the file before doing anything to it; it’s fairly straightforward, but there are some tricksy things going on occasionally, and recursion can bite you in annoying places in the anatomy if you’re not careful. It’s probably the file I’ve always been most tempted (along with, maybe, the color stuff, some of which is in the executable source); you’ll observe that I haven’t done so. I could never get the things I wanted to do stable enough, or there turned out to be a different way to go about it.