-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_all.py
52 lines (43 loc) · 1.26 KB
/
start_all.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
48
49
50
51
52
import subprocess
import time
import pyautogui
import pygetwindow as gw
source_folder = "brski-py"
scripts = [
"Pledge/pledge.py",
"Registrar/registrar.py",
"MASA/masa.py",
"Authorities/authority.py",
]
titles = ["Pledge", "Registrar", "MASA", "Authority"]
# Launch each script in a separate command prompt window and set a custom title
for script, title in zip(scripts, titles):
script_path = f"{source_folder}/{script}"
subprocess.Popen(
f"cmd /k title {title} && py {script_path}",
creationflags=subprocess.CREATE_NEW_CONSOLE,
)
# Allow some time for the windows to open
time.sleep(5)
windows = []
for title in titles:
window = gw.getWindowsWithTitle(title)
if window:
windows.append(window[0])
# Define screen layout
screen_width, screen_height = pyautogui.size()
window_width = screen_width // 2
window_height = screen_height // 2
positions = [
(0, 0), # Top-left
(window_width, 0), # Top-right
(0, window_height), # Bottom-left
(window_width, window_height), # Bottom-right
]
# Align the windows on the screen
for window, pos in zip(windows, positions):
try:
window.moveTo(pos[0], pos[1])
window.resizeTo(window_width, window_height)
except Exception as e:
pass