Skip to content

Instantly share code, notes, and snippets.

@mylamour
Created August 12, 2021 07:16
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 mylamour/84d9fddfd4de3ca2b9aa138f933be91b to your computer and use it in GitHub Desktop.
Save mylamour/84d9fddfd4de3ca2b9aa138f933be91b to your computer and use it in GitHub Desktop.
"Keep me online"
import time
import random
import pyautogui
FLAG = True
OFFLINETIME = "18:00:00"
while True:
t = time.localtime()
current_time = time.strftime("%H:%M:%S", t)
if current_time == OFFLINETIME:
pyautogui.alert('下班了.')
break
if FLAG:
pyautogui.hotkey('ctrl','right')
FLAG = False
else:
pyautogui.hotkey('ctrl','left')
FLAG=True
pyautogui.PAUSE = random.randint(5, 10) # time.sleep(random.randint(10,80))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment