equal
deleted
inserted
replaced
|
1 Dim action |
|
2 action = "asis" |
|
3 |
|
4 If WScript.Arguments.Count <> 1 then |
|
5 WScript.quit |
|
6 End If |
|
7 |
|
8 If WScript.Arguments.item(0) = "on" Then |
|
9 action = "on" |
|
10 Else |
|
11 action = "off" |
|
12 End If |
|
13 |
|
14 |
|
15 ' Dim Locator |
|
16 ' Dim Service |
|
17 ' Dim QfeSet |
|
18 ' Dim Qfe |
|
19 |
|
20 ' Set Locator = WScript.CreateObject("WbemScripting.SWbemLocator") |
|
21 ' Set Service = Locator.ConnectServer |
|
22 ' Set QfeSet = Service.ExecQuery("Select * From Win32_DesktopMonitor") |
|
23 |
|
24 ' Dim accum |
|
25 ' accum = 0 |
|
26 |
|
27 ' If Qfeset.Count = 2 Then |
|
28 ' For Each Qfe In QfeSet |
|
29 ' accum = accum * 10 |
|
30 ' accum = accum + Qfe.Availability |
|
31 ' Next |
|
32 ' If accum = 38 Or accum = 83 Then |
|
33 ' action = "on" |
|
34 ' ElseIf accum = 33 Then |
|
35 ' action = "off" |
|
36 ' End If |
|
37 ' End If |
|
38 |
|
39 Dim objWsh |
|
40 Set objWsh = WScript.CreateObject("WScript.Shell") |
|
41 objWsh.Run "control.exe desk.cpl ,4" |
|
42 Do Until objWsh.AppActivate("画面のプロパティ") |
|
43 WScript.Sleep 100 |
|
44 Loop |
|
45 |
|
46 If action = "on" Then |
|
47 objWsh.SendKeys "{TAB}" |
|
48 objWsh.SendKeys "2" |
|
49 objWsh.SendKeys "{TAB 4}" |
|
50 objWsh.SendKeys " " |
|
51 objWsh.SendKeys "{UP 19}" |
|
52 objWsh.SendKeys "{LEFT 29}" |
|
53 objWsh.SendKeys "{DOWN 7}" |
|
54 objWsh.SendKeys "{TAB 9}" |
|
55 'objWsh.SendKeys "{ENTER}" |
|
56 ElseIf action = "off" Then |
|
57 objWsh.SendKeys "{TAB}" |
|
58 objWsh.SendKeys "2" |
|
59 objWsh.SendKeys "{TAB 5}" |
|
60 objWsh.SendKeys " " |
|
61 objWsh.SendKeys "{TAB 8}" |
|
62 'objWsh.SendKeys "{ENTER}" |
|
63 End If |
|
64 |