Push Button State Change (Multiple Conditions)

Okay, that worked beautifully - thank you so much! Now that I've tested it quite a few times... I think I'm going to have to tweak it even further. The button press isn't tied to a physical button, it's a laser signal, and I'm monitoring when it turns on and off. I'm saving the On/Off messages to a database and it's going to balloon the storage size pretty quickly. I think the better way to do it is to count how long the laser is on in one minute intervals. I still need this script to run (so it wasn't a waste of time) I just won't be logging the data it outputs, it will be displayed in real-time.