# HG changeset patch # User Shingo W. Kagami # Date 1264089633 -32400 # Node ID 3b65651e7033b77c169f406f09df663c2c13fbe0 Add toggle_dualdisp.vbs. diff -r 000000000000 -r 3b65651e7033 disp/toggle_dualdisp.vbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/disp/toggle_dualdisp.vbs Fri Jan 22 01:00:33 2010 +0900 @@ -0,0 +1,64 @@ +Dim action +action = "asis" + +If WScript.Arguments.Count <> 1 then + WScript.quit +End If + +If WScript.Arguments.item(0) = "on" Then + action = "on" +Else + action = "off" +End If + + +' Dim Locator +' Dim Service +' Dim QfeSet +' Dim Qfe + +' Set Locator = WScript.CreateObject("WbemScripting.SWbemLocator") +' Set Service = Locator.ConnectServer +' Set QfeSet = Service.ExecQuery("Select * From Win32_DesktopMonitor") + +' Dim accum +' accum = 0 + +' If Qfeset.Count = 2 Then +' For Each Qfe In QfeSet +' accum = accum * 10 +' accum = accum + Qfe.Availability +' Next +' If accum = 38 Or accum = 83 Then +' action = "on" +' ElseIf accum = 33 Then +' action = "off" +' End If +' End If + +Dim objWsh +Set objWsh = WScript.CreateObject("WScript.Shell") +objWsh.Run "control.exe desk.cpl ,4" +Do Until objWsh.AppActivate("画面のプロパティ") + WScript.Sleep 100 +Loop + +If action = "on" Then + objWsh.SendKeys "{TAB}" + objWsh.SendKeys "2" + objWsh.SendKeys "{TAB 4}" + objWsh.SendKeys " " + objWsh.SendKeys "{UP 19}" + objWsh.SendKeys "{LEFT 29}" + objWsh.SendKeys "{DOWN 7}" + objWsh.SendKeys "{TAB 9}" + 'objWsh.SendKeys "{ENTER}" +ElseIf action = "off" Then + objWsh.SendKeys "{TAB}" + objWsh.SendKeys "2" + objWsh.SendKeys "{TAB 5}" + objWsh.SendKeys " " + objWsh.SendKeys "{TAB 8}" + 'objWsh.SendKeys "{ENTER}" +End If +