Enable/disable button in cad button

I implemented a button card to perform the WOL of a pc. It works. What I would like to achieve is that the button is enabled if the pc is turned off. I already have a sensor that detects the on/off condition. However, in the button card there is no possibility to change the status on a condition. Does anyone have an idea? Thanks in advance

Put the WOL in a script, rather than the button card, and call the script from the button?

Thank you for the answer. And what changes?