Jump to content


Photo

[SOLVED] Move inactive windows


  • Please log in to reply
1 reply to this topic

#1 iDrug

iDrug
  • Members
  • 282 posts

Posted 10 October 2012 - 11:04 PM

Solution provided by creature.ws
#if !WinUnderMousePointerActive()
    !Lbutton::KDE_WinMove("Lbutton")
#if
 
WinUnderMousePointerActive()
{
    MouseGetPos,,, hWnd
    return WinActive("ahk_id" hWnd)
}
 
KDE_WinMove(sButton)
{
    if !GetKeyState(sButton, "P")
        Exit
 
    CoordMode, Mouse
    MouseGetPos, x1, y1, id
    WinExist("ahk_id" . id)
 
    WinGetClass, winClass
    if (winClass == "WorkerW" || winClass == "Progman")
        Exit
 
    WinGet, win, MinMax
    if (win)
        Exit
 
    SetWinDelay, 0
    WinGetPos, winX1, winY1
    while GetKeyState(sButton, "P")
    {
        MouseGetPos, x2, y2
        x2 -= x1, y2 -= y1, winX2 := winX1 + x2, winY2 := winY1 + y2
        WinMove,,, winx2, winY2
        Sleep 15
    }
}

This code let's you move inactive windows by doing these steps:
1. hover the inactive window you'd like to move
2. hit and hold ALT key
3. hit and hold left mouse click
4. drag the cursor

#2 DeWild1

DeWild1
  • Members
  • 369 posts

Posted 11 October 2012 - 01:17 AM

#IfWinNotActive is not for the top and will not do anything.
Example,
IfWinNotActive, Untitled - Notepad
{
  msgbox, notepad is not active
}