Last active
March 15, 2024 11:01
-
-
Save KtanPatel/317eae0925ba928ed0d80169f6cf8269 to your computer and use it in GitHub Desktop.
[Windows] Change screen (Windows screen change [Alt+tab] and tab change [ctrl+tab]), aero key and pageUp + Down Key events for tracking software like upwork, freelancer ...
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
#!/usr/bin/python | |
# eg: python tracker-event-bot.py 50 5 0 | |
# syntax: filename total_sec event_sec shutdown_binary_flag | |
# shutdown_binary_flag => "0 = no", "> 0 = yes & shutdown after that seconds on end of script" | |
import sys | |
from time import sleep | |
import random | |
import ctypes | |
import os | |
TOTAL_TIME = 60 | |
SLEEP_TIME = 5 | |
START_TIME = 0 | |
ALLOW_SHUTDOWN = 0 | |
if len(sys.argv) == 4: | |
TOTAL_TIME = float(sys.argv[1]) | |
SLEEP_TIME = float(sys.argv[2]) | |
ALLOW_SHUTDOWN = int(sys.argv[3]) | |
elif len(sys.argv) == 3: | |
TOTAL_TIME = float(sys.argv[1]) | |
SLEEP_TIME = float(sys.argv[2]) | |
elif len(sys.argv) == 2: | |
TOTAL_TIME = float(sys.argv[1]) | |
else: | |
print('Something Wrong. Syntax Error: expect => :filename.py Total_time_sec event_time_sec shutdown_binary_flag') | |
sys.exit(0) | |
KEYS = [[0x12, 0x09], [0x12, 0x09], [0x12, 0x09], [0x11, 0x09], [0x11, 0x09], [0x11, 0x09], [0x25, 0x26], [0x25, 0x26], [0x25, 0x26], [0x25, 0x26], [0x25, 0x26], [0x25, 0x26], [ | |
0x21, 0x28], [0x27, 0x22]] # Alt+tab Ctrl+tab Left+Up pgUp+Down Up+PgDown | |
while True: | |
if START_TIME > TOTAL_TIME: | |
if ALLOW_SHUTDOWN > 0: | |
os.system("shutdown /s /t " + ALLOW_SHUTDOWN) | |
break | |
else: | |
break | |
index = random.randint(0, len(KEYS) - 1) | |
user32 = ctypes.windll.user32 | |
# print(KEYS[index]) | |
user32.keybd_event(KEYS[index][0], 0, 0, 0) | |
sleep(0.2) | |
user32.keybd_event(KEYS[index][1], 0, 0, 0) | |
sleep(0.2) | |
i = index | |
while KEYS[index][0] in [0x12, 0x11] and i > 0: | |
user32.keybd_event(KEYS[index][1], 0, 0x0002, 0) | |
sleep(0.2) | |
user32.keybd_event(KEYS[index][1], 0, 0, 0) | |
i = i - 1 | |
user32.keybd_event(KEYS[index][0], 0, 0x0002, 0) | |
user32.keybd_event(KEYS[index][1], 0, 0x0002, 0) | |
sleep(SLEEP_TIME) | |
# os.system('clear') | |
os.system('cls') | |
print('Time Spent: ==>', START_TIME) | |
print('Time Remaining: ==>', TOTAL_TIME - START_TIME) | |
print() | |
START_TIME += SLEEP_TIME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment