-
Notifications
You must be signed in to change notification settings - Fork 174
/
scrollOverTaskbarToSwitchTasks.ahk
86 lines (78 loc) · 2.04 KB
/
scrollOverTaskbarToSwitchTasks.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Count := 0
SetKeyDelay, 20
Return
#If TaskBarHovering()
WheelDown::
Max := Num()
If Count <= 1
Count := Max
Else
Count --
If (Count <= Max && Count > 1)
ControlSend,, % (TaskBarPos() = "Top" || TaskBarPos() = "Bottom") ? "{Right}" : "{Down}", ahk_class TaskListThumbnailWnd
Else
ControlSend, MSTaskListWClass1, % (TaskBarPos()="Top" || TaskBarPos()="Bottom") ? "{Right}{Up}" : "{Down}{Left}", ahk_class Shell_TrayWnd
SetTimer, Check, 50
Return
WheelUp::
Max := Num()
If Max = 0
Return
If Count <= 1
Count := Max
Else
Count --
If (Count > 1 && Count <= Max)
ControlSend,, % (TaskBarPos() = "Top" || TaskBarPos() = "Bottom") ? "{Left}" : "{Up}", ahk_class TaskListThumbnailWnd
Else
ControlSend, MSTaskListWClass1, % (TaskBarPos() = "Top" || TaskBarPos() = "Bottom") ? "{Left}{Up}" : "{Up}{Left}", ahk_class Shell_TrayWnd
SetTimer, Check, 50
Return
#If
Check:
If !TaskBarHovering()
{
Max := Num()
If Max = 0
Return
If Count <= 1
Count := Max
Else
Count --
If (Count > 1 && Count <= Max)
ControlSend,, {Enter}, ahk_class TaskListThumbnailWnd
Else
ControlSend, MSTaskListWClass1, {Enter}, ahk_class Shell_TrayWnd
;ControlSend, , {Enter}, ahk_class TaskListThumbnailWnd
SetTimer, Check, Off
}
Return
Num()
{
static hModule := DllCall("LoadLibrary","Str","oleacc","UPtr")
hWnd := WinExist("ahk_class TaskListThumbnailWnd")
If !hWnd
Return, 0
VarSetCapacity(IID,16)
NumPut(0x11CF3C3D618736E0,IID,0,"Int64")
NumPut(0x719B3800AA000C81,IID,8,"Int64")
If !DllCall("oleacc\AccessibleObjectFromWindow","UPtr",hWnd
,"UInt",0xFFFFFFFC
,"UPtr",&IID
,"UPtr*",pAcc)
{
Stack := ComObjParameter(9,pAcc,1)
StackSize := Stack.accChildCount // 3
Return, StackSize
}
Return, 0
}
TaskBarHovering()
{
MouseGetPos,,, hWnd
Return, hWnd = WinExist("ahk_class Shell_TrayWnd")
}
TaskBarPos() {
WinGetPos,X,Y,W,H,ahk_class Shell_TrayWnd
return x=0 ? y=0 ? h<w ? "Top" : "Left" : "Bottom" : "Right"
}