I tried to convert this script to v2 on my own, but didn't succeed: https://github.com/alexofrhodes/AHK-DockWindows/blob/main/Class%20Dock.ahk, so can someone help me to reach my goal? It can be different script to translate from or you can take your own shot and do it maybe not so smooth and fancy, but simple.
So, I have GUI which can be activated up to 6 times, and it would be great if all these windows could be linked and moved when one window is moved. As I said, I'm noob, so my function for positioning windows relatively to each other may be not well optimised and good at all, but at least it works at first glance (actually, it works well only when windows are opened in sequential order, but if you close at least one window and open it again, everything breaks, haha).
Code: Select all
f::{
Static Order := 0
if Order > 5 {
return
}
G := Gui('+AlwaysOnTop -MinimizeBox +Owner', 'Static Title'), G.SetFont('s15 bold', 'Arial')
G.Add('Edit', 'r1 w35 +Border +Center +Disabled', ++Order)
G.OnEvent('Close', (*) => (--Order, G.Destroy())), G.OnEvent('Escape', (*) => (--Order, G.Destroy()))
if !WinExist('ahk_class AutoHotkeyGUI') {
G.Show('w425 h285')
}
else {
for This_ID in IDs := WinGetList('ahk_class AutoHotkeyGUI') {
WinGetPos(&X, &Y, &W, &H, This_ID)
if IDs.Length = 1 {
WinMove(X-W/2+9,,,, This_ID)
G.Show('w425 h285 x' X+W/2-9)
}
if IDs.Length = 2 {
WinMove(, Y-H/2+4,,, This_ID)
G.Show('w425 h285 y' Y+H/2-5)
}
if IDs.Length = 3 {
WinMove(X-W/2+9,,,, 'ahk_class AutoHotkeyGUI')
G.Show('w425 h285 x' X+W-18 ' y' Y+H-9)
}
if IDs.Length = 4 {
G.Show('w425 h285 x' X-W+17 ' y' Y+H/2-9)
}
if IDs.Length = 5 {
G.Show('w425 h285 x' X+W*2-35 ' y' Y+H/2-9)
}
}
}
}