I'd like to write a script to organize the windows I currently have open on my screen.
Ex: Move all browsers to monitor 1 and everything else to monitor 2
Ex: Make the 4 maximized windows on monitor 1 each take up equal sized quadrants on the screen
etc..
I assume VBScript would be good for this? What Objects would I use for this in a Win7 environment?
This isn't possible in VBScript out-of-the-box, because it doesn't provide access to Windows APIs used for window management.
AutoIt seems a better tool for the job. Look into the following functions and macros:
WinMove
- move windows
_WinAPI_GetSystemMetrics
(80)
- get the number of monitors
@DesktopWidth
and @DesktopHeight
- primary monitor pixel size
_WinAPI_GetSystemMetrics(78)
and _WinAPI_GetSystemMetrics(79)
- full desktop width and heigth
If the monitor dimensions are different, you can use the WMI class Win32_DesktopMonitor
and its ScreenWidth
and ScreenHeigth
properties to get individual monitor dimensions.
I'm not sure if I'd say that VBS would be good for this, I think I'd prefer C++ for this since it would involve Windows API calls which I think is easier in C++, but it depends on your skills and VBS might be fine.
The API calls I'd look at would be EnumWindows or FindWindow to find the windows you want to move around and then SetWindowPos for moving them.
I think that if you want to move them to a secondary monitor, you should be able to do that by moving it to a position outside of the primary monitor (possibly a negative position if the secondary monitor is extended on the left for example).
To do this you would need to be able to find out the current resolution and such which I think you can get from the WMI class Win32_VideoController.