-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteams_nudger.py
47 lines (37 loc) · 1.25 KB
/
teams_nudger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
# Written by: Abhigyan Kumar
import pyautogui as autogui
from datetime import datetime as dt
from time import sleep
from os import system
"""
TBD/Issues:
1. Find a more elegant solution, overall.
2. This still causes a python window to be popped up in FOREGROUND to be effective.
3. Get the top left and bottom right max possiblities dynamically.
"""
autogui.FAILSAFE = False # prevent the double shake exit.
format_time = "%H:%M:%S"
count = 1
flag_for_main = True
total_count_to_wait = int(150/20)
def fun(): # shake arount the mouse.
x,y = autogui.position()
autogui.moveTo(1000, 510, .3, autogui.easeInBounce)
autogui.moveTo(50, 50, .2, autogui.easeInBounce)
autogui.moveTo(x,y,1,autogui.easeInBounce)
def tick(cur_time): # One sleep cycle.
print(cur_time.strftime(format_time))
sleep(20)
# Main loop.
# First launch: shake the mouse and hten go into waiting stage.
while(flag_for_main):
system('cls')
print("Started execution")
print("Count:",count)
fun()
# sleep(150) # Wasn't really informative and lead to confusion.
for i in range(total_count_to_wait):
tick(dt.now())
print("completed a nudge to prevent away status! :D\n Waiting for timeout ")
count += 1