first commit

This commit is contained in:
Walker Waylon Scott 2016-11-22 23:33:54 -06:00
commit 35491679b8
10 changed files with 503 additions and 0 deletions

28
stodle.py Normal file
View file

@ -0,0 +1,28 @@
"""
stodle
small module to keep windows running
"""
from win32api import GetTickCount, GetLastInputInfo
from ctypes import windll
def stop_idle(seconds=1, debug=False, debug_statement='user inactive'):
"""
Detects idle and creates a mouse event to keep windows running
:param seconds: numeric - time in seconds before making an event
:param debug: bool - if true prints the print statement
:param print_statement: statement to print when user is idle
"""
last_input = (GetTickCount() - GetLastInputInfo()) / 1000
if last_input >= seconds:
if debug:
print(debug_statement)
windll.user32.mouse_event(1, 1, 1, 0, 0)
if __name__ == '__main__':
while True:
stop_idle(debug=True)