if u use this code u get an error message during execusion that $sleeping is not declared when attempting to solve the if statement? i declared it as a global variable to be able to change its value in wakeup(). is $sleeping locked while running the sleeping() function?

HotKeySet is not calling wakeup() when pressing the key combination. do i have to do something else than calling HotKeySet(...) at the beginning of the scipt to get it working?