Jump to content

WinMove two windows. 1/4 and 3/4


Go to solution Solved by Subz,

Recommended Posts

I am trying to move two windows so they fit on the same screen. 

I would like one window to be 1/4 the screen and the Other to be 3/4 of the screen. (One on top of the other not side by side.) 

Is it possible to get this to work with all monitor sizes?

Local $hRun1 = _Run('notepad.exe', 0,((@DesktopWidth + 50)/2),@DesktopWidth,@DesktopHeight/1.75)
Local $hRun2 = _Run('notepad.exe', 0, 0, @DesktopWidth,@DesktopHeight/1.25)

Func _Run($sRunCommand, $iX, $iY, $iW, $iH)
    Local $aWinList_Before = WinList("[CLASS:Notepad]")
    Run($sRunCommand)
    Do
        $aWinList_After = WinList("[CLASS:Notepad]")
    Until $aWinList_After[0][0] > $aWinList_Before[0][0]
    Local $hWnd = $aWinList_After[1][1]
    Sleep(1000)
    WinMove($hWnd, "", $iX, $iY, $iW, $iH)
EndFunc

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

  • SkysLastChance changed the title to WinMove two windows. 1/4 and 3/4
  • Solution

Wouldn't it be something like:

Local $hRun2 = _Run('notepad.exe', 0, 0, @DesktopWidth,@DesktopHeight/3)
Local $hRun1 = _Run('notepad.exe', 0,@DesktopHeight/3,@DesktopWidth,@DesktopHeight/3 * 2)

Func _Run($sRunCommand, $iX, $iY, $iW, $iH)
    Local $aWinList_Before = WinList("[CLASS:Notepad]")
    Run($sRunCommand)
    Do
        $aWinList_After = WinList("[CLASS:Notepad]")
    Until $aWinList_After[0][0] > $aWinList_Before[0][0]
    Local $hWnd = $aWinList_After[1][1]
    Sleep(1000)
    WinMove($hWnd, "", $iX, $iY, $iW, $iH)
EndFunc

 

Link to comment
Share on other sites

I ended up going with this. I appreciate the help as always @Subz :)

Local $hRun1 = _Run('notepad.exe', 0,0,@DesktopWidth,@DesktopHeight/4 * 3)
Local $hRun2 = _Run('notepad.exe', 0, @DesktopHeight/4 * 3, @DesktopWidth,@DesktopHeight/4)

Func _Run($sRunCommand, $iX, $iY, $iW, $iH)
    Local $aWinList_Before = WinList("[CLASS:Notepad]")
    Run($sRunCommand)
    Do
        $aWinList_After = WinList("[CLASS:Notepad]")
    Until $aWinList_After[0][0] > $aWinList_Before[0][0]
    Local $hWnd = $aWinList_After[1][1]
    Sleep(1000)
    WinMove($hWnd, "", $iX, $iY, $iW, $iH)
EndFunc

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...