aboutsummaryrefslogtreecommitdiff
path: root/tt.windowselect.ahk
blob: eb674134f84acaf643b02ed988c8919742b17f4e (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
;; Select window by number ----------------------------------------------------

;; -> body

*#1::QuickLaunch(1)
*#2::QuickLaunch(2)
*#3::QuickLaunch(3)
*#4::QuickLaunch(4)
*#5::QuickLaunch(5)
*#6::QuickLaunch(6)
*#7::QuickLaunch(7)
*#8::QuickLaunch(8)
*#9::QuickLaunch(9)
*#0::QuickLaunch(10)

/*
#1::Taskbar(1)
#2::Taskbar(2)
#3::Taskbar(3)
#4::Taskbar(4)
#5::Taskbar(5)
#6::Taskbar(6)
#7::Taskbar(7)
#8::Taskbar(8)
#9::Taskbar(9)
#0::Taskbar(10)
*/

; Shortcuts
*#q::QuickLaunch(4)
*#w::QuickLaunch(5)
*#a::QuickLaunch(6)
/*
#q::Taskbar(4)
#w::Taskbar(5)
#a::Taskbar(6)
*/

/*
#q::
hwnd := WinActive("A")
WinGet, mm, MinMax, ahk_id %hwnd%
WinGetPos, wx, wy, ww, wh, ahk_id %hwnd%
MsgBox, %wx%x%wy% -- %ww%x%wh%
if ((mm = 0) && (wx = 0) && (xy = 0) && (ww = A_ScreenWidth) && (wh = A_ScreenHeight))
	WinActivate, ahk_class Progman
return
*/

;; -> library

QuickLaunch(n)
{
	static start := 56	; set this to your start menu button width
	static width := 24	; set this to your taskbar button width
	static offset := 0	; don't change this
	if (offset = 0)
		offset := 15
	else
		offset := 0
	x := start + width*(n-1) + offset
	
	; Activate taskbar if full-screen
	WinGetPos, wx, wy, ww, wh, A
	if (wx = 0 and wy = 0 and ww = A_ScreenWidth and wh = A_ScreenHeight)
		WinActivate, ahk_class Shell_TrayWnd
	
	;DllCall("SwitchToThisWindow", "UInt", WinExist("ahk_class Progman"), "UInt", 1)
	tmp := A_CoordModeMouse
	CoordMode, Mouse, Screen
	MouseGetPos, ox, oy
	BlockInput, MouseMove
	MouseClick, Left, %x%, %A_ScreenHeight%, 1, 0
	MouseMove, %ox%, %oy%, 0
	BlockInput, MouseMoveOff
	CoordMode, Mouse, %tmp%
}

Taskbar(n)
{
	static start := 63	; set this to your start menu button width
	static width := 63	; set this to your taskbar button width
	static offset := 0	; don't change this
	if (offset = 0)
		offset := 15
	else
		offset := 0
	x := start + width*(n-1) + offset
	
	; Activate taskbar if full-screen
	WinGetPos, wx, wy, ww, wh, A
	if (wx = 0 and wy = 0 and ww = A_ScreenWidth and wh = A_ScreenHeight)
		WinActivate, ahk_class Shell_TrayWnd
	
	;DllCall("SwitchToThisWindow", "UInt", WinExist("ahk_class Progman"), "UInt", 1)
	tmp := A_CoordModeMouse
	CoordMode, Mouse, Screen
	MouseGetPos, ox, oy
	BlockInput, MouseMove
	MouseClick, Left, %x%, %A_ScreenHeight%, 1, 0
	MouseMove, %ox%, %oy%, 0
	BlockInput, MouseMoveOff
	CoordMode, Mouse, %tmp%
}