Question:
I use a laptop as my primary workstation. Sometimes I work alone on it, but a significant portion of the time, I’m at my office desk and I hook up an external monitor to increase my workspace.
Every time I perform this action, I click the same dialog boxes in Windows Vista to setup the dual screen and position the window. It seems like a repeatable task that I could automate.
I’d like to be able to plug in my monitor cable, double click a program and have it automatically configure the monitor.
What type of program could do this? I haven’t found much online that relates. I’m thinking of trying an autohotkey script, or the Windows Accessibility API with PowerShell. Has this problem already been solved?
Clarification: I’m specifically looking to automate the steps I use with my mouse that invoke the base functionality in Windows Vista.
- Right click on desktop
- Select Personalize in context menu
- Click display settings
- Click monitor #2, then click checkbox to “Extend desktop to this monitor”
- Click and drag monitor #2 to the left of monitor #1
- Click OK to close the dialog
- Click Yes in the subsequent pop up to accept these monitor settings
Update: Windows 7 does this automatically
I just upgraded to Windows 7 and it remembered my dual monitor settings. I set them once at work as listed above, then unplugged and worked at home over the weekend. I came in on Monday morning, booted up, plugged in and whammo! It just worked. Thanks Windows 7!
Answer:
Here I am, three years later, answering my own question! Yay!!!
This is easily scripted with http://www.autohotkey.com
Here’s an example script for swapping between one monitor and two monitors with Windows+1 and Windows+2. AutoHotKey also allows for click and drag behavior that would be needed to swap the position of the second monitor.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Recommended for catching common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #1:: Send {LWin} WinWaitActive Start menu Send Adjust Screen Resolution Send {enter} WinWaitActive Screen Resolution ControlClick ComboBox3 Send {PgDn} Send {Up} ; Select "Show desktop only on 1" Send {enter} Sleep 3000 ; workaround - cannot select accept/revert window? Send {left} Send {enter} ; accept changes Return #2:: Send {LWin} WinWaitActive Start menu Send Adjust Screen Resolution Send {enter} WinWaitActive Screen Resolution ControlClick ComboBox3 Send {PgDn} Send {Up} Send {Up} ; Select "Extend these displays" Send {enter} Sleep 3000 ; workaround - cannot select accept/revert window? Send {left} Send {enter} ; accept changes Return |