Anyone tried to pause a simulation with a UPS alert?

Thinking of setting up a script to pause/save a simulation if my UPS alerts that there was a power failure that is long enough to cause the battery to dip below a threshold. 

SolidworksSimulation