Windows-Werkzeug, das die Sprechtaste in Squad haelt, solange man redet. - Hauptprogramm mit tkinter-Oberflaeche, Pegelanzeige und Diagnose - Auto-Updater gegen https://sva.tyrveil.com/version.json mit SHA-256-Pruefung - Inno-Setup-Installer und Build-Skript werkzeuge/baue_release.py - Projektuebergabe mit den bekannten Fallstricken Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
"""Nimmt das Fenster inklusive Titelleiste auf."""
|
|
import ctypes
|
|
import ctypes.wintypes as wintypes
|
|
import subprocess
|
|
import sys
|
|
import tkinter as tk
|
|
|
|
sys.path.insert(0, r"C:\Users\danie\Downloads\Squad_Local_Voice_Activation_v2")
|
|
import squad_voice_activation as m
|
|
|
|
OUT = (r"C:\Users\danie\AppData\Local\Temp\claude"
|
|
r"\C--Users-danie-Downloads-Squad-Local-Voice-Activation-v2"
|
|
r"\64d89be0-cffb-4a90-bed0-f23f786b3017\scratchpad\titelleiste.png")
|
|
|
|
|
|
class RECT(ctypes.Structure):
|
|
_fields_ = [("left", wintypes.LONG), ("top", wintypes.LONG),
|
|
("right", wintypes.LONG), ("bottom", wintypes.LONG)]
|
|
|
|
|
|
root = tk.Tk()
|
|
m.apply_tactical_theme(root)
|
|
app = m.VoiceActivationApp(root)
|
|
root.attributes("-topmost", True)
|
|
app.current_level = 0.041
|
|
|
|
|
|
def capture():
|
|
root.update_idletasks()
|
|
root.update()
|
|
hwnd = ctypes.windll.user32.GetParent(root.winfo_id()) or root.winfo_id()
|
|
r = RECT()
|
|
ctypes.windll.user32.GetWindowRect(wintypes.HWND(hwnd), ctypes.byref(r))
|
|
x, y = r.left, r.top
|
|
w, h = r.right - r.left, r.bottom - r.top
|
|
ps = ("Add-Type -AssemblyName System.Drawing;"
|
|
f"$b = New-Object System.Drawing.Bitmap {w},{h};"
|
|
"$g = [System.Drawing.Graphics]::FromImage($b);"
|
|
f"$g.CopyFromScreen({x},{y},0,0,$b.Size);"
|
|
f"$b.Save('{OUT}');$g.Dispose();$b.Dispose()")
|
|
subprocess.run(["powershell", "-NoProfile", "-Command", ps],
|
|
capture_output=True)
|
|
print("gespeichert:", OUT, f"({w}x{h})")
|
|
root.destroy()
|
|
|
|
|
|
root.after(2500, capture)
|
|
root.mainloop()
|