aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tt.windows.ahk11
1 files changed, 8 insertions, 3 deletions
diff --git a/tt.windows.ahk b/tt.windows.ahk
index 87f04e4..e6b93f5 100644
--- a/tt.windows.ahk
+++ b/tt.windows.ahk
@@ -47,9 +47,14 @@ if (mm = -1)
return
#c:: ; minimize last window
-SendInput, !{Tab}
-Sleep, 50
-WinMinimize, A
+GW_HWNDNEXT := 2
+hwnd := WinActive("A")
+Loop {
+ hwnd := DllCall("GetWindow", "ptr", hwnd, "uint", GW_HWNDNEXT)
+ if (DllCall("IsWindowVisible", "ptr", hwnd) = 1)
+ break
+}
+WinMinimize, ahk_id %hwnd%
return