Files
MosisService/designer/test/diagnose.ahk
2026-01-16 12:43:06 +01:00

125 lines
3.4 KiB
AutoHotkey

; Mosis Designer Diagnostic Script
; AutoHotkey v2
; Outputs window information without user interaction
#Requires AutoHotkey v2.0
; Simple config (inline to avoid include issues)
WINDOW_TITLE := "Mosis Designer"
PHONE_WIDTH := 540
PHONE_HEIGHT := 960
; Output file
outputFile := A_ScriptDir . "\diagnose_output.txt"
; Clear previous output
if (FileExist(outputFile))
FileDelete(outputFile)
; Helper to write output
WriteOutput(msg) {
FileAppend(msg . "`n", outputFile)
}
WriteOutput("=== Mosis Designer Diagnostic ===")
WriteOutput("Time: " . A_Now)
WriteOutput("")
; Find window
hwnd := WinExist(WINDOW_TITLE)
if (!hwnd) {
WriteOutput("ERROR: Window '" . WINDOW_TITLE . "' not found")
WriteOutput("")
WriteOutput("Looking for any GLFW windows...")
; Try to find any GLFW window
windows := WinGetList()
for wnd in windows {
title := WinGetTitle(wnd)
class := WinGetClass(wnd)
if (InStr(class, "GLFW") || InStr(title, "Mosis") || InStr(title, "Designer")) {
WriteOutput("Found candidate: " . wnd . " - Title: " . title . " - Class: " . class)
}
}
ExitApp()
}
WriteOutput("Window found!")
WriteOutput("HWND: " . hwnd)
; Get window info
title := WinGetTitle(hwnd)
class := WinGetClass(hwnd)
WinGetPos(&winX, &winY, &winW, &winH, hwnd)
WriteOutput("Title: " . title)
WriteOutput("Class: " . class)
WriteOutput("Position: X=" . winX . " Y=" . winY)
WriteOutput("Size: W=" . winW . " H=" . winH)
; Estimate client area
; For GLFW windows, borders are typically small
; Let's try different estimates
WriteOutput("")
WriteOutput("=== Client Area Estimates ===")
; Method 1: Standard Windows decorations
borderW := 8
titleH := 31
clientX1 := winX + borderW
clientY1 := winY + titleH
WriteOutput("Estimate 1 (standard border): X=" . clientX1 . " Y=" . clientY1)
; Method 2: Minimal border (GLFW often uses this)
borderW2 := 1
titleH2 := 1
clientX2 := winX + borderW2
clientY2 := winY + titleH2
WriteOutput("Estimate 2 (minimal border): X=" . clientX2 . " Y=" . clientY2)
; Method 3: No border (borderless window)
WriteOutput("Estimate 3 (no border): X=" . winX . " Y=" . winY)
; Calculate expected phone area size vs actual window
WriteOutput("")
WriteOutput("=== Size Analysis ===")
WriteOutput("Expected phone size: " . PHONE_WIDTH . "x" . PHONE_HEIGHT)
WriteOutput("Actual window size: " . winW . "x" . winH)
expectedW := PHONE_WIDTH + (2 * 8) ; borders
expectedH := PHONE_HEIGHT + 31 + 8 ; title + border
WriteOutput("Expected window size (with decorations): " . expectedW . "x" . expectedH)
; Check if window is maximized or has different size
if (winW > PHONE_WIDTH + 50 || winH > PHONE_HEIGHT + 100) {
WriteOutput("WARNING: Window seems larger than expected - may be scaled or maximized")
}
; Try a click test (won't do anything without activation, but log coordinates)
WriteOutput("")
WriteOutput("=== Click Coordinate Test ===")
; Phone center
phoneX := 270
phoneY := 480
; Convert to screen (using estimate 1)
screenX := clientX1 + phoneX
screenY := clientY1 + phoneY
WriteOutput("Phone center (270, 480) -> Screen (" . screenX . ", " . screenY . ")")
; Phone app icon position
phoneAppX := 67
phoneAppY := 120
screenAppX := clientX1 + phoneAppX
screenAppY := clientY1 + phoneAppY
WriteOutput("Phone app icon (67, 120) -> Screen (" . screenAppX . ", " . screenAppY . ")")
WriteOutput("")
WriteOutput("=== Diagnostic Complete ===")
WriteOutput("Output written to: " . outputFile)
ExitApp()