1

Тема: AHK: Позиционирование

Есть ли поддержка позиционирования в AHK? Чтобы при изменении размера окна элементы перемещались или увеличивались/уменьшались. Конечно можно отслеживать, когда человек начинает изменять размер окна, но это для каждого окна будет разный код, куча кода который будет засорять программу...

2

Re: AHK: Позиционирование

Подозреваю, без кучи кода не обойтись. Вот что нашёл через справку, функция Anchor, автор Titan — http://www.autohotkey.net/~Titan/anchor.html.

Gui, +Resize
Gui, Add, Edit, x8 y8 w200
Gui, Show, AutoSize, HELLO
Return

GuiClose:
    ExitApp

GuiSize:
    Anchor("Edit1", "hw")
Return

; ---------------------- Функция ---------------------

/*
    Function: Anchor
        Defines how controls should be automatically positioned relative to the new dimensions of a window when resized.

    Parameters:
        cl - a control HWND, associated variable name or ClassNN to operate on
        a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height),
            optionally followed by a relative factor, e.g. "x h0.5"
        r - (optional) true to redraw controls, recommended for GroupBox and Button types

    Examples:
> "xy" ; bounds a control to the bottom-left edge of the window
> "w0.5" ; any change in the width of the window will resize the width of the control on a 2:1 ratio
> "h" ; similar to above but directrly proportional to height

    Remarks:
        To assume the current window size for the new bounds of a control (i.e. resetting) simply omit the second and third parameters.
        However if the control had been created with DllCall() and has its own parent window,
            the container AutoHotkey created GUI must be made default with the +LastFound option prior to the call.
        For a complete example see anchor-example.ahk.

    License:
        - Version 4.60a <http://www.autohotkey.net/~Titan/#anchor>
        - Simplified BSD License <http://www.autohotkey.net/~Titan/license.txt>
*/
Anchor(i, a = "", r = false) {
    static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff
    If z = 0
        VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true
    If (!WinExist("ahk_id" . i)) {
        GuiControlGet, t, Hwnd, %i%
        If ErrorLevel = 0
            i := t
        Else ControlGet, i, Hwnd, , %i%
    }
    VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), "UInt", &gi)
        , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int")
    If (gp != gpi) {
        gpi := gp
        Loop, %gl%
            If (NumGet(g, cb := gs * (A_Index - 1)) == gp) {
                gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1
                Break
            }
        If (!gf)
            NumPut(gp, g, gl), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs
    }
    ControlGetPos, dx, dy, dw, dh, , ahk_id %i%
    Loop, %cl%
        If (NumGet(c, cb := cs * (A_Index - 1)) == i) {
            If a =
            {
                cf = 1
                Break
            }
            giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short")
                , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short")
            Loop, Parse, a, xywh
                If A_Index > 1
                    av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField)
                        , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1)
            DllCall("SetWindowPos", "UInt", i, "Int", 0, "Int", dx, "Int", dy
                , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4)
            If r != 0
                DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE
            Return
        }
    If cf != 1
        cb := cl, cl += cs
    bx := NumGet(gi, 48), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52)
    If cf = 1
        dw -= giw - gw, dh -= gih - gh
    NumPut(i, c, cb), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short")
        , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short")
    Return, true
}

3

Re: AHK: Позиционирование

По-моему, этот Anchor всё только путает. Достаточно обычного способа:

   Gui, +Resize
   Gui, Add, Edit, x0 y0 w200 h170
   Gui, Add, Button, x145 y175 h20 w50, Exit
   Gui, Show, w200 h200
   Return

GuiSize:
   GuiControl, Move, Edit1, % "w" A_GuiWidth " h" A_GuiHeight - 30
   GuiControl, MoveDraw, Button1, % "x" A_GuiWidth - 55 " y" A_GuiHeight - 25
   Return

GuiClose:
ButtonExit:
   ExitApp
Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

4

Re: AHK: Позиционирование

По-моему, это ты путаешь. Anchor — универсальная функция, а твой код для конкретной пары Edit + Button. Какие контролы нужны сейчас и будут нужны потом Resager'у, неизвестно. Если разные и с разными привязками, получится тот же Anchor. Смысл писать его заново? Resager, кстати, ясно выразил нежелание такой код писать. Ну, если у тебя есть желание выполнять все его заявки, то дело другое, конечно.

5

Re: AHK: Позиционирование

YMP пишет:

Anchor — универсальная функция

Нет, не совсем так. Она сработает, только когда изменение размеров/позиции контролов линейно зависит от изменения размеров окна. Впрочем, не спорю, наверное, она может быть полезной.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

6

Re: AHK: Позиционирование

teadrinker пишет:

Нет, не совсем так. Она сработает, только когда изменение размеров/позиции контролов линейно зависит от изменения размеров окна.

А при чём тут это? Вроде бы ясно, о какой универсальности я говорил.

YMP пишет:

Anchor — универсальная функция, а твой код для конкретной пары Edit + Button. Какие контролы нужны сейчас и будут нужны потом Resager'у, неизвестно.

Ты просто взял и отрезал контекст. Нафига так делать-то?

teadrinker пишет:

Впрочем, не спорю, наверное, она может быть полезной.

Ну так и я об этом не спорю. Ничего банальнее того, что рабочий код может быть (наверное) полезен, и придумать невозможно. Стал бы я спорить о такой ерунде.

7

Re: AHK: Позиционирование

YMP пишет:

Вроде бы ясно, о какой универсальности я говорил.

Да, я не совсем верно тебя понял.
Так известно, что универсальность далеко не всегда хороша! Ну вот, например, "универсальный" размер кресел в маршрутках китайского производства. Для китайцев, может, и ничего, а для нас тесновато!
Вот тебе конкретный пример.
При уменьшении ширины окна кнопки "сталкиваются":

   Gui, +Resize
   Gui, Add, Edit, x0 y0 w200 h170
   Gui, Add, Button, x145 y175 h20 w50, Exit
   Gui, Add, Button, x5 yp hp wp, OK
   Gui, Show, w200 h200
   Return

GuiSize:
   Anchor("Edit1", "wh"), Anchor("Button1", "xy", 1), Anchor("Button2", "y", 1)
   Return

GuiClose:
ButtonExit:
   ExitApp

/*
    Function: Anchor
        Defines how controls should be automatically positioned relative to the new dimensions of a window when resized.

    Parameters:
        cl - a control HWND, associated variable name or ClassNN to operate on
        a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height),
            optionally followed by a relative factor, e.g. "x h0.5"
        r - (optional) true to redraw controls, recommended for GroupBox and Button types

    Examples:
> "xy" ; bounds a control to the bottom-left edge of the window
> "w0.5" ; any change in the width of the window will resize the width of the control on a 2:1 ratio
> "h" ; similar to above but directrly proportional to height

    Remarks:
        To assume the current window size for the new bounds of a control (i.e. resetting) simply omit the second and third parameters.
        However if the control had been created with DllCall() and has its own parent window,
            the container AutoHotkey created GUI must be made default with the +LastFound option prior to the call.
        For a complete example see anchor-example.ahk.

    License:
        - Version 4.60a <http://www.autohotkey.net/~Titan/#anchor>
        - Simplified BSD License <http://www.autohotkey.net/~Titan/license.txt>
*/
Anchor(i, a = "", r = false) {
    static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff
    If z = 0
        VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true
    If (!WinExist("ahk_id" . i)) {
        GuiControlGet, t, Hwnd, %i%
        If ErrorLevel = 0
            i := t
        Else ControlGet, i, Hwnd, , %i%
    }
    VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), "UInt", &gi)
        , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int")
    If (gp != gpi) {
        gpi := gp
        Loop, %gl%
            If (NumGet(g, cb := gs * (A_Index - 1)) == gp) {
                gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1
                Break
            }
        If (!gf)
            NumPut(gp, g, gl), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs
    }
    ControlGetPos, dx, dy, dw, dh, , ahk_id %i%
    Loop, %cl%
        If (NumGet(c, cb := cs * (A_Index - 1)) == i) {
            If a =
            {
                cf = 1
                Break
            }
            giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short")
                , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short")
            Loop, Parse, a, xywh
                If A_Index > 1
                    av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField)
                        , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1)
            DllCall("SetWindowPos", "UInt", i, "Int", 0, "Int", dx, "Int", dy
                , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4)
            If r != 0
                DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE
            Return
        }
    If cf != 1
        cb := cl, cl += cs
    bx := NumGet(gi, 48), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52)
    If cf = 1
        dw -= giw - gw, dh -= gih - gh
    NumPut(i, c, cb), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short")
        , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short")
    Return, true
}

Универсально, но криво.
А вот так всё в порядке:

   Gui, +Resize
   Gui, Add, Edit, x0 y0 w200 h170
   Gui, Add, Button, x5 y175 h20 w50, OK
   Gui, Add, Button, x145 yp hp wp, Exit
   Gui, Show, w200 h200
   Return

GuiSize:
   GuiControl, Move, Edit1, % "w" A_GuiWidth " h" A_GuiHeight - 30
   GuiControl, MoveDraw, Button1, % "y" A_GuiHeight - 25
   GuiControl, MoveDraw, Button2, % "x" (A_GuiWidth>=115 ? A_GuiWidth - 55 : 60) " y" A_GuiHeight - 25
   Return

GuiClose:
ButtonExit:
   ExitApp

Этот пример — просто первое, что пришло в голову. На практике наверняка можно столкнуться и с другими проблемами.
Вывод: такие "универсальные" вещи можно использовать ограниченно, если думать лень!

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

8

Re: AHK: Позиционирование

teadrinker, а в чем разница в этих двух примерах? Я не заметил.

9

Re: AHK: Позиционирование

В первом случае при уменьшении ширины окна кнопки наезжают одна на другую.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

10

Re: AHK: Позиционирование

teadrinker пишет:

При уменьшении ширины окна кнопки "сталкиваются"

teadrinker пишет:

В первом случае при уменьшении ширины окна кнопки наезжают одна на другую.

Кто-то пытается мухлевать. Нет, не совсем так (© teadrinker), не наезжают на, а именно только сталкиваются. Ну и почему кнопки не могут быть вплотную? Это как-то мешает их работе? Нет. Так в чём кривизна? По крайней мере так экономнее расходуется оконное пространство.

teadrinker пишет:

Вывод: такие "универсальные" вещи можно использовать ограниченно, если думать лень!

Resager пишет:

Конечно можно отслеживать, когда человек начинает изменять размер окна, но это для каждого окна будет разный код, куча кода который будет засорять программу...

По-моему, ясно, что как раз универсальное решение и запрашивалось. А твой разный код будет засорять программу.

11 (изменено: teadrinker, 2010-05-21 17:08:13)

Re: AHK: Позиционирование

YMP пишет:

Нет, не совсем так (© teadrinker), не наезжают на, а именно только сталкиваются.

Да нет же, именно наезжают одна на другую, проверь внимательнее.

YMP пишет:

А твой разный код будет засорять программу.

Едва ли! Даже если контролов и много, то 10-15 строчек под одной меткой GuiSize не сильно засорят программу!

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

12

Re: AHK: Позиционирование

У меня в обоих случаях кнопки ведут себя одинаково. Сталкиваются, но не наезжают друг на друга.

13 (изменено: teadrinker, 2010-05-21 17:35:53)

Re: AHK: Позиционирование

А так?

   Gui, +Resize
   Gui, Add, Edit, x0 y0 w200 h170
   Gui, Add, Button, x145 y175 h20 w50, Exit
   Gui, Add, Button, x40 yp hp wp, OK
   Gui, Show, w200 h200
   Return

GuiSize:
   Anchor("Edit1", "wh"), Anchor("Button1", "xy", 1), Anchor("Button2", "y", 1)
   Return

GuiClose:
ButtonExit:
   ExitApp

/*
    Function: Anchor
        Defines how controls should be automatically positioned relative to the new dimensions of a window when resized.

    Parameters:
        cl - a control HWND, associated variable name or ClassNN to operate on
        a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height),
            optionally followed by a relative factor, e.g. "x h0.5"
        r - (optional) true to redraw controls, recommended for GroupBox and Button types

    Examples:
> "xy" ; bounds a control to the bottom-left edge of the window
> "w0.5" ; any change in the width of the window will resize the width of the control on a 2:1 ratio
> "h" ; similar to above but directrly proportional to height

    Remarks:
        To assume the current window size for the new bounds of a control (i.e. resetting) simply omit the second and third parameters.
        However if the control had been created with DllCall() and has its own parent window,
            the container AutoHotkey created GUI must be made default with the +LastFound option prior to the call.
        For a complete example see anchor-example.ahk.

    License:
        - Version 4.60a <http://www.autohotkey.net/~Titan/#anchor>
        - Simplified BSD License <http://www.autohotkey.net/~Titan/license.txt>
*/
Anchor(i, a = "", r = false) {
    static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff
    If z = 0
        VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true
    If (!WinExist("ahk_id" . i)) {
        GuiControlGet, t, Hwnd, %i%
        If ErrorLevel = 0
            i := t
        Else ControlGet, i, Hwnd, , %i%
    }
    VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), "UInt", &gi)
        , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int")
    If (gp != gpi) {
        gpi := gp
        Loop, %gl%
            If (NumGet(g, cb := gs * (A_Index - 1)) == gp) {
                gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1
                Break
            }
        If (!gf)
            NumPut(gp, g, gl), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs
    }
    ControlGetPos, dx, dy, dw, dh, , ahk_id %i%
    Loop, %cl%
        If (NumGet(c, cb := cs * (A_Index - 1)) == i) {
            If a =
            {
                cf = 1
                Break
            }
            giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short")
                , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short")
            Loop, Parse, a, xywh
                If A_Index > 1
                    av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField)
                        , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1)
            DllCall("SetWindowPos", "UInt", i, "Int", 0, "Int", dx, "Int", dy
                , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4)
            If r != 0
                DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE
            Return
        }
    If cf != 1
        cb := cl, cl += cs
    bx := NumGet(gi, 48), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52)
    If cf = 1
        dw -= giw - gw, dh -= gih - gh
    NumPut(i, c, cb), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short")
        , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short")
    Return, true
}
   Gui, +Resize
   Gui, Add, Edit, x0 y0 w200 h170
   Gui, Add, Button, x40 y175 h20 w50, OK
   Gui, Add, Button, x145 yp hp wp, Exit
   Gui, Show, w200 h200
   Return

GuiSize:
   GuiControl, Move, Edit1, % "w" A_GuiWidth " h" A_GuiHeight - 30
   GuiControl, MoveDraw, Button1, % "y" A_GuiHeight - 25
   GuiControl, MoveDraw, Button2, % "x" (A_GuiWidth>150 ? A_GuiWidth - 55 : 95) " y" A_GuiHeight - 25
   Return

GuiClose:
ButtonExit:
   ExitApp
Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

14

Re: AHK: Позиционирование

Теперь в первом случае так, а во втором так.

оффтоп:
1. Не хватает кнопочки копировать весь код, или хотя бы выделения по двойному или тройному клику всего кода. Не очень удобно копировать длинный код.
2. Да и вообще этот холивар про универсальность кода конечно имеет право на существование, но в данном случае я считаю, каждый для себя выбирает более легкий и понятный путь. AHK вообще в некоторых местах не заточен под некоторые фишки, и приходится писать кучу кода ради какой-то мелочи.

15

Re: AHK: Позиционирование

У меня так же. А в прошлом примере с Anchor всё-таки не наезжают, а только смыкаются. Возможно, тут что-то ещё припутывается.

teadrinker пишет:

Даже если контролов и много, то 10-15 строчек под одной меткой GuiSize не сильно засорят программу!

У меня и 100-150 строчек не засорят, лишь бы работало. Но я подал это в преломлении Resager'a. Клиент же всегда прав. Вообще, мысль, что код засоряет программу мне понравилась. Свежая мысль. Действительно, программы должны сами работать, без этого противного кода, от которого рябит в глазах и болит в мозгах. Долой код из программ!

InFlames пишет:

Не хватает кнопочки копировать весь код, или хотя бы выделения по двойному или тройному клику всего кода. Не очень удобно копировать длинный код.

В IE тройной клик работает, а также одиночный при удержании Ctrl. Точнее, в Avant Browser, но он ведь только оболочка, вероятно, это функционал IE.

16

Re: AHK: Позиционирование

YMP пишет:

А в прошлом примере с Anchor всё-таки не наезжают, а только смыкаются.

Да это просто у меня минимально возможная ширина окна меньше, чем у вас. Думаю, она зависит от толщины строки заголовка окон, её можно менять в свойствах экрана.

InFlames пишет:

Не хватает кнопочки копировать весь код, или хотя бы выделения по двойному или тройному клику всего кода. Не очень удобно копировать длинный код.

Вот решение для Firefox.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

17

Re: AHK: Позиционирование

Можно ли в данном случае сделать так, что бы окно не сжималось меньше заданного значения.
Что бы были видны обе кнопки и хотя бы строк 5 элемента ListView.

Примерно вот такой размер был бы минимальным.

http://content.screencast.com/users/ktp/folders/Jing/media/20287ac8-9710-411d-8a24-681c1031e30f/2010-12-28_1902.png



    gui default
    Gui Add, ListView, x10 y0 vlv AltSubmit grid -LV0x10 r10 NoSort NoSortHdr, 1|2|3
    Gui add, button,  x10 y+10 w100 h35, Удалить выделенные
    Gui add, button,  x+10 yp wp hp, Открыть .INI
    gui +resize
    Gui show, AutoSize
Return

GuiSize:
   Anchor("lv", "wh")
   Anchor("button1", "y", 1)
   Anchor("button2", "y", 1)
Return

buttonУдалитьвыделенные:
Return

guiclose:
ExitApp
Return


Anchor(i, a = "", r = false) {
    static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff
    If z = 0
        VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true
    If (!WinExist("ahk_id" . i)) {
        GuiControlGet, t, Hwnd, %i%
        If ErrorLevel = 0
            i := t
        Else ControlGet, i, Hwnd, , %i%
    }
    VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), "UInt", &gi)
        , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int")
    If (gp != gpi) {
        gpi := gp
        Loop, %gl%
            If (NumGet(g, cb := gs * (A_Index - 1)) == gp) {
                gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1
                Break
            }
        If (!gf)
            NumPut(gp, g, gl), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs
    }
    ControlGetPos, dx, dy, dw, dh, , ahk_id %i%
    Loop, %cl%
        If (NumGet(c, cb := cs * (A_Index - 1)) == i) {
            If a =
            {
                cf = 1
                Break
            }
            giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short")
                , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short")
            Loop, Parse, a, xywh
                If A_Index > 1
                    av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField)
                        , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1)
            DllCall("SetWindowPos", "UInt", i, "Int", 0, "Int", dx, "Int", dy
                , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4)
            If r != 0
                DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE
            Return
        }
    If cf != 1
        cb := cl, cl += cs
    bx := NumGet(gi, 48), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52)
    If cf = 1
        dw -= giw - gw, dh -= gih - gh
    NumPut(i, c, cb), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short")
        , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short")
    Return, true
}

18

Re: AHK: Позиционирование

Gui, +/-Option1 +/-Option2 ...
MinSize and MaxSize

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

19

Re: AHK: Позиционирование

То что надо. Благодарю.