Created
December 12, 2022 12:30
-
-
Save Lay4U/6d447431e2c124b81a926ccb8a254074 to your computer and use it in GitHub Desktop.
beep_every_50_minute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from datetime import datetime | |
import win32api | |
import winsound | |
frequency = 1500 | |
duration = 100 | |
def getIdleTime(): | |
return (win32api.GetTickCount() - win32api.GetLastInputInfo()) / 1000.0 | |
while True: | |
now = datetime.now() | |
print(now, getIdleTime()) | |
if getIdleTime() > 3600: | |
time.sleep(60) | |
continue | |
elif now.minute == 50: | |
print(now) | |
print(getIdleTime()) | |
winsound.Beep(frequency, duration) | |
time.sleep(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment