forked from AdamHing/RobloxAFKBots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfocuslib.py
More file actions
26 lines (18 loc) · 667 Bytes
/
focuslib.py
File metadata and controls
26 lines (18 loc) · 667 Bytes
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
import win32gui
import win32process
import argparse
#this code cycles through all the roblox instances by their pid and focuses on the window.
ap=argparse.ArgumentParser()
ap.add_argument("-p", "--pid", type=int, required=True,help="the pid")
args=vars(ap.parse_args())
pids = args["pid"]
print(pids)
def enum_window_callback(hwnd, pid):
a,current_pid = win32process.GetWindowThreadProcessId(hwnd)
# print(pid)
print(current_pid)
# print(current_pid)
if pid == current_pid and win32gui.IsWindowVisible(hwnd):
win32gui.SetForegroundWindow(hwnd)
print("window activated")
win32gui.EnumWindows(enum_window_callback,pids)