Skip to content

Instantly share code, notes, and snippets.

@Lay4U
Created December 12, 2022 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lay4U/6d447431e2c124b81a926ccb8a254074 to your computer and use it in GitHub Desktop.
Save Lay4U/6d447431e2c124b81a926ccb8a254074 to your computer and use it in GitHub Desktop.
beep_every_50_minute
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