Thank you for your response. It's a good idea.
It works. In config.g I wrote:
M581 T2 E0 S0;
and in
trigger2.g :
M80 ;
M581 T2 S-1;
M581 T3 E0 S0;
trigger3.g:
M81
M581 T3 S-1;
M581 T2 E0 S0;
There is one drawback to this solution.
When the M80 or M81 is executed in a different way, eg via Web or g-code printing, the button must be pressed twice.
Thank you for your help and I will be grateful for other suggestions.