If I don't miss anything we do it the other way round: using a switch calls a script.
Is it possible to check the position of a switch? ... Can we also read out the positions of all switches?