Listed below is a DNS advanced script for positioning the active window how you would like it on your display. The example script will position the window on the left half of the main display, just change one line of the script as detailed at the end of the post to position the window on the right half of the display. Positioning the windows in top left, bottom left, top right, bottom right quarters of display can easily be implemented also by adjusting just a couple of lines of the script. The names I use for the scripts are as follows but you can choose your own names, just copy and paste the script into an advanced script.
"Left half of display"
"right half of display"
"top left of display"
"bottom left of display"
"top right of display"
"bottom right of display"
I would suggest copying this complete post into something like DragonPad or Wordpad and maximising the window to make it more readable.
I have put comments in the script to try and explain exactly what each line of code does. Obviously you can then modify and adapt to suit. The script follows, just copy and paste into an advanced script where it will be more readable as it will be displayed with the appropriate colours and syntax.
' Position active window on display
' scripts by Lindsay Adam 2008 email@example.com
' Declare Windows API functions
Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As _
Long, ByVal nCmdShow As Long) As Long
Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As _
Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As _
Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) _
' declare RECT structure for window position
Left As Long
Top As Long
Right As Long
Bottom As Long
' assign constants for SystemParametersInfo & ShowWindow API functions
Const SPI_GETWORKAREA = 48
' window handle, width,height,x-coord of top left-hand corner,y-coord(of window rectangle)
Dim hwnd,w,h,x,y As Long
' rectangle representing work area on screen available, taking taskbar, Dragon bar etc into account
Dim wRect As RECT
' initialiser rectangle with the current available working area
SystemParametersInfo(SPI_GETWORKAREA, vbNull, wRect, 0)
' get a handle of current active window even if it is minimised
hwnd = GetForegroundWindow()
' restore the window if it isn't already displayed e.g. it is minimised
' width of work area available
w=wRect.Right - wRect.Left
' height of work area available
h=wRect.Bottom - wRect.Top
' x-coordinate of top left hand corner of window so that the window is left half display
' position window on the left half of display
Hopefully Rüdiger can translate the explanation above into German, I don't trust the Google translation. You need to change different lines on the script depending on which window position you want to implement.
For the right half of the display just change the X coordinate line to the following:
x = wRect.Left + w/2
If anyone is interested in positioning windows and top left, bottom left, top right and bottom right quarters of display and you can't work out the maths then let me know and I will post the lines that need to be amended for quarter window sizes.