I think it's a bit more complicated than that.
You really want to do this in the M6 tool change macro.
You'll need to assign specific tool numbers to each spindle, and check the tool number, then turn on the appropriate spindle.
I'd use G52 to do the offset, rather than change offsets.