Use WinMove to move relative to location, instead of absolut destination

Viewed 43

Is it possible to move a window by for example 200 pixles downwards, or similar?

I have only found the WinMove command, but it requires an fixed location, instead of just moving the window a bit downwards for example.

So if I wanted to move the calc downwards a bit in the below example, how would I go about doing that?

Run, calc.exe WinWait, Calculator WinMove, xxxx? Thanks!

1 Answers

What you need in this case, is the WinGetPos command.

Example:

; Press F1 to move the Calculator window 10 pixel downwards:

F1::
    If !WinExist("Calculator") ; "!" means "NOT" in this case
        Run, calc.exe   
    WinWait, Calculator
    WinGetPos, X, Y, Width, Height, Calculator
    WinMove, Calculator, , X, Y+10
return
Related