-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathac.py
More file actions
37 lines (33 loc) · 988 Bytes
/
Copy pathac.py
File metadata and controls
37 lines (33 loc) · 988 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
27
28
29
30
31
32
33
34
35
36
37
import json
import pygetwindow as gw
import pyautogui
import time
import subprocess
pyautogui.FAILSAFE = False
# 从配置文件中加载配置
def load_config(config_file):
with open(config_file, "r", encoding="utf-8") as file:
return json.load(file)
# 主函数
def main():
# 加载配置
config = load_config("config.json")
browsers = config["browsers"]
edge_path = config["edge_path"]
# 打开网页并调整窗口
for browser in browsers:
url = browser["url"]
title = browser["title"]
screen_x, screen_y = browser["screen_position"]
screen_width, screen_height = browser["screen_size"]
# 匹配窗口标题
window = None
print(title)
w = gw.getWindowsWithTitle(title)
print(w)
# while gw.getWindowsWithTitle(title):
for win in gw.getWindowsWithTitle(title):
win.close()
print("所有网页关闭。")
if __name__ == "__main__":
main()