Recent Changes - Search:

APCU Wiki Home

Meeting Notes Meeting Notes Feed

Favorite links

What's New

New Battery Discussion

Historical notes and links

Creating New Topics

Ward's AutoIT scripts

That graphical outliner Ward uses: APCU.Freemind

APCU's web Home - Leave this wiki

APCU.WardsBlog

Basic Editing
MarkupMasterIndex
SandBox (Try things)

edit SideBar

SplitScreen

On the Yahoo group, I believe it was Spiro asked about a "split screen" ability in XP - something standard in Windows 7.

With it, you can drag a window to the left or right side of the screen and it will "snap" to being HALF a screen wide.

Ward decided this would be an interesting little AutoIT3 script project, and designed and wrote it in 1 hour.

Since it is a bit easy to find the cursor against the left or right side of the screen WITHOUT meaning to move something there, I set it to only work if you place the mouse in the CORNER of the screen for a while - either moving the TOP WINDOW to that side, -or- if already split, making it full screen again.

NOTE this conflicts with the "move to the corner" technique I use on my Magnifier program

In this you see it called "WarDock" but you can call it anything - splitscreen sounds more descriptive

On 09/11/14 I wrote up "Wardock" forgetting I had put it under "split screen"; I offer that "improved" page, as a PMWiki "Include": (:include Autoit3.Wardock:)

  • Why?
    • Windows 7 (and 8) have this neat feature where you can make a window take the left or right half of the screen.
    • With every widening "HD" monitors and laptops, this allows two applications side-by-side, or for example two Skype Chat windows both visible.
    • Implementation:
win+Result
Left ArrowMove current application to left half of screen
Right ArrowMove current application to Right half of screen
(also)Following unrelated to "left/right half"
Up ArrowMaximize
Down ArrowMinimize

Ward's Autoit3 script to do this function under XP which doesn't have the win-key

Instead, holding the mouse pointer controls the action:
Hold mouse in this corner:While the windows is thisCauses the window to:
upper or lower leftMaximizedoccupy the left half of the screen
upper or lower leftleft halfMaximize
upper or lower rightMaximizedoccupy the right half of the screen
upper or lower rightright halfMaximize

The script itself

;;; 12/05/10 00:23:46 - Tabula Rasa - Let's see what AutoIT can do..
;;; 12/05/10 01:30:20 - Works, tweaked, "publishable"
;;; wardock.au3
;;; Author: Ward Christensen
;;; Use: Move mouse to any screen corner and hold until the top window changes
;;;          If it was maximized, it will be docked left/right in half the screen width
#include <GuiConstants.au3>
Opt("WinTitleMatchMode", 2)

;
; Want 1/3 2/3 split?
;
$Third = 0

$width = @desktopwidth
$height = @desktopheight
$TaskBarHeight = floor($height/12)
$WinHeight = $height - $TaskBarHeight
dim $WindowsState
$Restored = 15                  ; exists, visible, enabled, and active
$Minimized = 31                 ; exists, visible, enabled, active, minimized
$Maximized = 47                 ; exists, visible, enabled, active, maximized

while 1
    $pos = mousegetpos()
    $InTopLeftCorner = 0
    $InBottomLeftCorner = 0
    $InTopRightCorner = 0
    $InBottomRightCorner = 0

    if $pos[0] = $width-1    and $pos[1] = 0           then $InTopRightCorner = 1
    if $pos[0] = $width-1    and $pos[1] = $height-1   then $InBottomRightCorner = 1
    if $pos[0] = 0           and $pos[1] = 0           then $InTopLeftCorner = 1
    if $pos[0] = 0           and $pos[1] = $height-1   then $InBottomLeftCorner = 1

 $TRC = $InTopRightCorner
 $BRC = $InBottomRightCorner
 $TLC = $InTopLeftCorner
 $BLC = $InBottomLeftCorner

    if ($TRC+$BRC+$TLC+$BLC) > 0 then
        $a = WinList()
        for $i = 1 to $a[0][0]
            $WindowsState = WinGetState($a[$i][1])
            if $WindowsState = $Restored or $WindowsState = $Minimized then
                $WindowName = $a[$i][0]
                WinMove($WindowName,"",-4,-4,$width+4,$height+4)
                WinSetState($WindowName,"",@SW_MAXIMIZE)
            endif
            if $WindowsState = $Maximized then
                $WindowName = $a[$i][0]
                $pos = WinGetPos($Windowname)
                $bott = $pos[3]
                WinSetState($WindowName,"",@SW_RESTORE)

                if $InTopLeftCorner = 1 then
                    if $third = 1 then
                        WinMove($WindowName,"",-4,-4,floor($width/3)+4,$bott+4)
                    else
                        WinMove($WindowName,"",-4,-4,$width/2+4,$bott+4)
                    endif
                endif

                if $InTopRightCorner = 1 then
                    if $third = 1 then
                        WinMove($WindowName,"",floor($width/3)-4,-4,2*floor($width/3)+4,$bott+4)
                    else
                        WinMove($WindowName,"",$width/2-4,-4,$width/2+4,$bott+4)
                    endif
                endif


                if $InBottomLeftCorner = 1 then
                    if $third = 1 then
                        WinMove($WindowName,"",-4,-4,$width+4,floor($WinHeight/3)+4)
                    else
                        WinMove($WindowName,"",-4,-4,$width+4,floor($WinHeight/2)+4)
                    endif
                endif

                if $InBottomRightCorner = 1 then
                    if $third = 1 then
                        WinMove($WindowName,"",-4,2*floor($WinHeight/3)-4,$width+8,floor($WinHeight/3)-4)
                    else
                        WinMove($WindowName,"",-4,floor($WinHeight/2)-4,$width+8,floor($WinHeight/2)-4)
                    endif
                endif

            endif
        next
    endif

    sleep(2000)
wend

  • Notes: You'll see some -4 numbers in the position calculations
    • This was done for my 1024-wide screen, and represents what I found about Windows: it maximized a window by "placing the border off-screen" (top, bottom, left, and right), which I found to be 4 pixels.
    • On a newer larger screen, I found the number to be -6, but being Windows 8, it, like Windows 7, has "half-screening" built-in as "win key + (right or left) arrow"
    • Better programming style would have been to set a variable $Border = 4 then reference +/-$Border

WardC September 13, 2014, at 01:02 PM

Edit - History - Print - Recent Changes - Search
Page last modified on September 13, 2014, at 03:56 PM