43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""E1 step1 v2: the schtask PowerShell console window COVERS the QMT client
|
|
(analyzed screenshot proved clicks landed on the console). So:
|
|
1) minimize our own console, 2) foreground QMT, 3) click python策略 tree item
|
|
(THIS boot, 3x-crop measured y=413, not the stale 385), 4) screenshot."""
|
|
import ctypes
|
|
import time
|
|
|
|
import pyautogui
|
|
|
|
pyautogui.FAILSAFE = False
|
|
|
|
# 1) minimize the console window hosting this very process
|
|
hwnd = ctypes.windll.kernel32.GetConsoleWindow()
|
|
if hwnd:
|
|
ctypes.windll.user32.ShowWindow(hwnd, 6) # SW_MINIMIZE
|
|
time.sleep(1.0)
|
|
|
|
# 2) bring the QMT client window to front (log all titles for diagnosis)
|
|
try:
|
|
import pygetwindow as gw
|
|
titles = [w.title for w in gw.getAllWindows() if (w.title or "").strip()]
|
|
print("TITLES:", "|".join(titles)[:600])
|
|
for w in gw.getAllWindows():
|
|
t = w.title or ""
|
|
if ("XtItClient" in t or "QMT" in t or "quant" in t.lower()
|
|
or "迅投" in t):
|
|
try:
|
|
w.activate()
|
|
print("ACTIVATED:", t)
|
|
except Exception as e:
|
|
print("activate ERR", repr(e))
|
|
break
|
|
except Exception as e:
|
|
print("focus ERR", repr(e))
|
|
time.sleep(1.0)
|
|
|
|
# 3) click python策略 (3x-crop verified on THIS boot: crop y=398 -> (398/3)+280 = 413)
|
|
pyautogui.click(75, 413)
|
|
time.sleep(3)
|
|
pyautogui.screenshot(r"C:\sanguo_bigqmt\shot_nav.png")
|
|
print("DONE nav2")
|