toggle_dualdisp.vbs
changeset 5 091708199d17
parent 4 1b55a5510213
child 6 0387681eee81
     1.1 --- a/toggle_dualdisp.vbs	Thu Jan 21 14:04:22 2010 +0900
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,64 +0,0 @@
     1.4 -Dim action
     1.5 -action = "asis"
     1.6 -
     1.7 -If WScript.Arguments.Count <> 1 then
     1.8 -   WScript.quit
     1.9 -End If
    1.10 -
    1.11 -If WScript.Arguments.item(0) = "on" Then
    1.12 -    action = "on"
    1.13 -Else
    1.14 -    action = "off"
    1.15 -End If
    1.16 -
    1.17 -
    1.18 -' Dim Locator
    1.19 -' Dim Service
    1.20 -' Dim QfeSet
    1.21 -' Dim Qfe
    1.22 -
    1.23 -' Set Locator = WScript.CreateObject("WbemScripting.SWbemLocator")
    1.24 -' Set Service = Locator.ConnectServer
    1.25 -' Set QfeSet = Service.ExecQuery("Select * From Win32_DesktopMonitor")
    1.26 -
    1.27 -' Dim accum
    1.28 -' accum = 0
    1.29 -
    1.30 -' If Qfeset.Count = 2 Then
    1.31 -'     For Each Qfe In QfeSet
    1.32 -'         accum = accum * 10
    1.33 -'         accum = accum + Qfe.Availability        
    1.34 -'     Next
    1.35 -'     If accum = 38 Or accum = 83 Then
    1.36 -'         action = "on"
    1.37 -'     ElseIf accum = 33 Then
    1.38 -'         action = "off"
    1.39 -'     End If
    1.40 -' End If
    1.41 -
    1.42 -Dim objWsh
    1.43 -Set objWsh = WScript.CreateObject("WScript.Shell")
    1.44 -objWsh.Run "control.exe desk.cpl ,4"
    1.45 -Do Until objWsh.AppActivate("画面のプロパティ")
    1.46 -    WScript.Sleep 100
    1.47 -Loop
    1.48 -
    1.49 -If action = "on" Then
    1.50 -    objWsh.SendKeys "{TAB}"
    1.51 -    objWsh.SendKeys "2"
    1.52 -    objWsh.SendKeys "{TAB 4}"
    1.53 -    objWsh.SendKeys " "
    1.54 -    objWsh.SendKeys "{UP 19}"
    1.55 -    objWsh.SendKeys "{LEFT 29}"
    1.56 -    objWsh.SendKeys "{DOWN 7}"
    1.57 -    objWsh.SendKeys "{TAB 9}"
    1.58 -    'objWsh.SendKeys "{ENTER}"
    1.59 -ElseIf action = "off" Then
    1.60 -    objWsh.SendKeys "{TAB}"
    1.61 -    objWsh.SendKeys "2"
    1.62 -    objWsh.SendKeys "{TAB 5}"
    1.63 -    objWsh.SendKeys " "
    1.64 -    objWsh.SendKeys "{TAB 8}"
    1.65 -    'objWsh.SendKeys "{ENTER}"
    1.66 -End If
    1.67 -