Shingo@2: Dim action Shingo@2: action = "asis" Shingo@2: Shingo@2: If WScript.Arguments.Count <> 1 then Shingo@2: WScript.quit Shingo@2: End If Shingo@2: Shingo@2: If WScript.Arguments.item(0) = "on" Then Shingo@2: action = "on" Shingo@2: Else Shingo@2: action = "off" Shingo@2: End If Shingo@2: Shingo@2: Shingo@2: ' Dim Locator Shingo@2: ' Dim Service Shingo@2: ' Dim QfeSet Shingo@2: ' Dim Qfe Shingo@2: Shingo@2: ' Set Locator = WScript.CreateObject("WbemScripting.SWbemLocator") Shingo@2: ' Set Service = Locator.ConnectServer Shingo@2: ' Set QfeSet = Service.ExecQuery("Select * From Win32_DesktopMonitor") Shingo@2: Shingo@2: ' Dim accum Shingo@2: ' accum = 0 Shingo@2: Shingo@2: ' If Qfeset.Count = 2 Then Shingo@2: ' For Each Qfe In QfeSet Shingo@2: ' accum = accum * 10 Shingo@2: ' accum = accum + Qfe.Availability Shingo@2: ' Next Shingo@2: ' If accum = 38 Or accum = 83 Then Shingo@2: ' action = "on" Shingo@2: ' ElseIf accum = 33 Then Shingo@2: ' action = "off" Shingo@2: ' End If Shingo@2: ' End If Shingo@2: Shingo@2: Dim objWsh Shingo@2: Set objWsh = WScript.CreateObject("WScript.Shell") Shingo@2: objWsh.Run "control.exe desk.cpl ,4" Shingo@2: Do Until objWsh.AppActivate("画面のプロパティ") Shingo@2: WScript.Sleep 100 Shingo@2: Loop Shingo@2: Shingo@2: If action = "on" Then Shingo@2: objWsh.SendKeys "{TAB}" Shingo@2: objWsh.SendKeys "2" Shingo@2: objWsh.SendKeys "{TAB 4}" Shingo@2: objWsh.SendKeys " " Shingo@2: objWsh.SendKeys "{UP 19}" Shingo@2: objWsh.SendKeys "{LEFT 29}" Shingo@2: objWsh.SendKeys "{DOWN 7}" Shingo@2: objWsh.SendKeys "{TAB 9}" Shingo@2: 'objWsh.SendKeys "{ENTER}" Shingo@2: ElseIf action = "off" Then Shingo@2: objWsh.SendKeys "{TAB}" Shingo@2: objWsh.SendKeys "2" Shingo@2: objWsh.SendKeys "{TAB 5}" Shingo@2: objWsh.SendKeys " " Shingo@2: objWsh.SendKeys "{TAB 8}" Shingo@2: 'objWsh.SendKeys "{ENTER}" Shingo@2: End If Shingo@2: