The question is, are you using the mill and foamcutter? If just the foamcutter is used, it would be easy, as the gcode
for control is there already.
M3/M5 could be used for the hotwire on/off even with timedelay for warmup
M7/M8 turn on Laser, M9 turn off both
I think in terminal halcmd show pin > pinlist.txt give a list of available pins. Just find the ones needed
and copy paste to avoid typos.
In this case would be spindle as mentioned before, and coolant, example:
net coolant-mist <= iocontrol.0.coolant-mist => hm2_7i76e.0.7i76.0.0.output-15
net coolant-flood <= iocontrol.0.coolant-flood => hm2_7i76e.0.7i76.0.0.output-07
about the relay, from a certain dimension a freewhelin diode is needed. 1n4xxx
Actually reading your post again, about the requirement. If you want to control that with keyboard key,
shure pl7i92 has the answer how to map keys and do halui call.
Eventually have 3 switches installed near your keyboard, then you can turn on off anytime as desired. From
keyboard it might be locked while active running file.