|
1 | 1 | #include <WinAPI.au3>
|
2 | 2 |
|
3 |
| -HotKeySet("#{PGUP}", "NextMon") |
4 |
| -HotKeySet("#{PGDN}", "PrevMon") |
| 3 | +Opt("TrayAutoPause", 0) |
| 4 | +Opt("TrayMenuMode", 3) |
| 5 | +Opt("TrayOnEventMode", 1) |
5 | 6 |
|
6 |
| -While 1 |
7 |
| - Sleep(60000) |
8 |
| -WEnd |
| 7 | +Main() |
| 8 | + |
| 9 | +Func Main() |
| 10 | + HotKeySet("#{PGUP}", "NextMon") |
| 11 | + HotKeySet("#{PGDN}", "PrevMon") |
| 12 | + |
| 13 | + TrayCreateEventItem("Next Monitor", "NextMon") |
| 14 | + TrayCreateEventItem("Previous Monitor", "PrevMon") |
| 15 | + TrayCreateItem("") |
| 16 | + TrayCreateEventItem("Exit", "ExitScript") |
| 17 | + |
| 18 | + Idle() |
| 19 | +EndFunc |
| 20 | + |
| 21 | +Func Idle() |
| 22 | + While 1 |
| 23 | + Sleep(60000) |
| 24 | + WEnd |
| 25 | +EndFunc |
| 26 | + |
| 27 | +Func ExitScript() |
| 28 | + Exit |
| 29 | +EndFunc |
| 30 | + |
| 31 | +Func TrayCreateEventItem($text, $function) |
| 32 | + TrayCreateItem($text) |
| 33 | + TrayItemSetOnEvent(-1, $function) |
| 34 | +EndFunc |
9 | 35 |
|
10 | 36 | Func VirtScreenWidth()
|
11 |
| - Return _WinAPI_GetSystemMetrics(78) |
| 37 | + Return _WinAPI_GetSystemMetrics(78) |
12 | 38 | EndFunc
|
13 | 39 |
|
14 | 40 | Func VirtScreenMinX()
|
15 |
| - Return _WinAPI_GetSystemMetrics(76) |
| 41 | + Return _WinAPI_GetSystemMetrics(76) |
16 | 42 | EndFunc
|
17 | 43 |
|
18 | 44 | Func VirtScreenMaxX()
|
19 |
| - Return VirtScreenMinX() + VirtScreenWidth() |
| 45 | + Return VirtScreenMinX() + VirtScreenWidth() |
20 | 46 | EndFunc
|
21 | 47 |
|
22 | 48 | Func NextMon()
|
23 |
| - $newX = MouseGetPos(0) + @DesktopWidth |
24 |
| - If ($newX <= VirtScreenMaxX()) Then |
25 |
| - MouseMove($newX, MouseGetPos(1),0) |
26 |
| - EndIf |
| 49 | + $newX = MouseGetPos(0) + @DesktopWidth |
| 50 | + If ($newX <= VirtScreenMaxX()) Then |
| 51 | + MouseMove($newX, MouseGetPos(1),0) |
| 52 | + EndIf |
27 | 53 | EndFunc
|
28 | 54 |
|
29 | 55 | Func PrevMon()
|
30 |
| - $newX = MouseGetPos(0) - @DesktopWidth |
31 |
| - if ($newX >= VirtScreenMinX()) Then |
32 |
| - MouseMove($newX, MouseGetPos(1),0) |
33 |
| - EndIf |
| 56 | + $newX = MouseGetPos(0) - @DesktopWidth |
| 57 | + if ($newX >= VirtScreenMinX()) Then |
| 58 | + MouseMove($newX, MouseGetPos(1),0) |
| 59 | + EndIf |
34 | 60 | EndFunc
|
0 commit comments