在Vista中自动执行双显示器设置

a7d*_*rew 5 powershell automation accessibility

我用笔记本电脑作为我的主要工作站.有时我独自工作,但很大一部分时间,我在我的办公桌,我连接外部显示器,以增加我的工作空间.

每次执行此操作时,我都会在Windows Vista中单击相同的对话框来设置双屏并定位窗口.这似乎是一个可重复的任务,我可以自动化.

我希望能够插入我的显示器电缆,双击程序并让它自动配置显示器.

什么类型的程序可以做到这一点?我没有发现很多相关的在线.我正在考虑使用PowerShell尝试autohotkey脚本或Windows Accessibility API.这个问题已经解决了吗?

澄清:我特别希望自动化我使用鼠标调用Windows Vista中的基本功能的步骤.

  1. 右键单击桌面
  2. 在上下文菜单中选择个性化
  3. 单击显示设置
  4. 单击监视器#2,然后单击复选框以"将桌面扩展到此监视器"
  5. 单击并将监视器#2拖动到监视器#1的左侧
  6. 单击"确定"关闭对话框
  7. 在随后的弹出窗口中单击是以接受这些监视器设置

更新:Windows 7自动执行此操作

我刚刚升级到Windows 7,它记得我的双显示器设置.我将它们设置为上面列出的工作一次,然后在周末不插电并在家工作.星期一早上我进来了,启动了,插上电源,然后哇哇!它刚刚起作用.谢谢Windows 7!

a7d*_*rew 0

三年后,我在这里回答我自己的问题!耶!!!

使用http://www.autohotkey.com可以轻松编写脚本

下面是一个示例脚本,用于在 Windows+1 和 Windows+2 的一台显示器和两台显示器之间进行交换。AutoHotKey 还允许交换第二个监视器的位置所需的单击和拖动行为。

#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
Run Code Online (Sandbox Code Playgroud)