Thank you very much Wolfgang, It works very well and perfectly suits my needs. Thanks again,
Le 24 mai 2019 à 18:05, Wolfgang Schuster
a écrit : The problem is that you put the letter-environment in a command but the environment uses the buffer mechanism to store the content which doesn't work when it is used in a command definition.
What you have to do is to move the content of the letters out of the \GenLetter command, you can use the lettercontent-environment for this. In the \GenLetter command you now use the \placeletter command to flush the content of the letter with the current values for the address etc.
%%%% begin example \usemodule[letter]
\setupletter [signature={JPR}, closing={Sincerely yours,}]
\setupletter [ toname=\correspondenceparameter{to}, toaddress=\correspondenceparameter{adr}, opening=\correspondenceparameter{civ}]
\startlettercontent Blah blah \correspondenceparameter{civ}. \stoplettercontent
\def\GenLetter[#1]% {\begingroup \setupletter[#1]% \placeletter \endgroup}
\starttext
\GenLetter[civ={M.}, to={Pierre Durand}, adr={Trifouillis-les-Oies}]
\stoptext %%%% end example
Wolfgang
-- Jean-Philippe Rey jean-philippe.rey@centralesupelec.fr 91192 Gif-sur-Yvette Cedex - France Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51