@DavidHyper maybe here M581 and carefully look at your duet version. there are big differences in this command.
create file called trigger2.g and put there all you want.
assign this trigger to one of the pins
once you activate pin, than macro is executed.