-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwindow-switch-multiple.ahk
45 lines (32 loc) · 1.21 KB
/
window-switch-multiple.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
!;::
{
static LastRun := 0
static QuickPress := 0
Now := A_TickCount
if (Now - LastRun < 400)
QuickPress++
else
QuickPress := 0
OutputDebug '`n`nNow: ' Now ' LastRun: ' LastRun ' QuickPress: ' QuickPress '`n'
OldClass := WinGetClass("A")
ActiveProcessName := WinGetProcessName("A")
WinClassCount := WinGetCount("ahk_exe " ActiveProcessName)
ActiveId := WinGetID("A")
OutputDebug 'Current: ' ActiveId '/' OldClass '/' ActiveProcessName '/' WinGetTitle("ahk_id" ActiveId) "`n"
if (WinClassCount = 1)
Return
ToSkip := QuickPress
OutputDebug 'Will skip ' ToSkip ' of ' WinClassCount '`n'
ids := WinGetList("ahk_exe " ActiveProcessName)
for SiblingId in ids {
if (WinGetClass("ahk_id" SiblingId) != OldClass)
continue
OutputDebug 'Found: ' SiblingId '/' WinGetClass("ahk_id" SiblingId) '/' WinGetProcessName("ahk_id" SiblingId) '/' WinGetTitle("ahk_id" SiblingId) '`n'
if (SiblingId != ActiveId && ToSkip-- <=0) {
OutputDebug 'Switch to: ' SiblingId '/' WinGetClass("ahk_id" SiblingId) '/' WinGetProcessName("ahk_id" SiblingId) '/' WinGetTitle("ahk_id" SiblingId) '`n'
WinActivate("ahk_id" SiblingId)
break
}
}
LastRun := A_TickCount
}