-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathputtyCluster.ahk
More file actions
159 lines (143 loc) · 3.16 KB
/
puttyCluster.ahk
File metadata and controls
159 lines (143 loc) · 3.16 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#SingleInstance force
#NoTrayIcon
Gui, Add, Text,, Windows Title Pattern (RegEx):
Gui, Add, Edit, vtitle w200,
Gui, Add, Text,, found 0 window(s)
Gui, Add, button, X130 y50 gLocate -default, locate window(s)
Gui, Add, Text, x10, Window transparency:
GUI, Add, Slider, x10 Range100-255 w200 gFind, 255
Gui, Add, Text,x10 vignore w100, cluster input:
Gui, Add, Edit,x10 WantTab ReadOnly,
Gui, Add, button, X140 y155 gGoPaste -default, paste clipboard
Gui, Add, button, X10 y185 gTile -default, Tile
Gui, Add, button, X40 y185 gCascade -default, Cascade
Gui, Add, Edit, x100 y187 vwidth w30 Number, 800
Gui, Add, Text,x138 y189, X
Gui, Add, Edit, x150 y187 vheight w30 Number, 400
;Gui, Add, Checkbox, x190 y190 vauto, auto
Gui, +AlwaysOnTop
Gui, Show, h215 w250, Mingbo's cluster Putty
onMessage(0x100,"key") ; key down
onMessage(0x101,"key") ; key up
onMessage(0x104,"key") ; alt key down
onMessage(0x105,"key") ; alt key down
SetTimer, Find , 1000
SetTitleMatchMode, RegEx
#WinActivateForce
xstep := 50
ystep := 40
key(wParam, lParam,msg, hwnd)
{
global paste
if (paste ==1) {
return
}
GuiControlGet, currentInput, Focus
if(currentInput="Edit2"){
global id
Loop, %id%
{
this_id := id%A_Index%
if(this_id >0){
PostMessage, %msg%,%wParam%, %lParam% , ,ahk_id %this_id%,
}
}
GuiControl,,Edit2,
}
}
return
GuiClose:
ExitApp
Tile:
Gosub, Find
x:=0
y:=0
Loop, %id%
{
this_id := id%A_Index%
if( this_id > 0){
;WinActivate, ahk_id %this_id%,
WinMove, ahk_id %this_id%,, x,y,width,height
x:=x+width
if( (x+width) >= A_ScreenWidth){
x:=0
y:=y+height
}
}
}
return
Cascade:
Gosub, Find
x:=0
y:=0
Loop, %id%
{
this_id := id%A_Index%
if( this_id > 0){
WinMove, ahk_id %this_id%,, x,y,width,height
x:=x+xstep
y:=y+ystep
}
}
return
GoPaste:
Gosub, Find
ControlSetText, Edit2, no input while pasting....
paste=1
clipboard=%clipboard%
Loop, %id%
{
this_id := id%A_Index%
if( this_id >0 ){
WinActivate, ahk_id %this_id%
SendRaw, %clipboard%
}
}
paste=0
ControlSetText, Edit2,
return
Locate:
Gosub, Find
Loop, %id%
{
this_id := id%A_Index%
if( this_id >0){
WinActivate, ahk_id %this_id%,
; PostMessage, 0x112, 0xF020,,, ahk_id %this_id%,
; PostMessage, 0x112, 0xF120,,, ahk_id %this_id%,
}
}
return
Find:
gui, Submit, nohide
if( title != "")
{
WinGet,id, list, %title%
notPutty := 0
Loop, %id%
{
this_id := id%A_Index%
WinGet, name, ProcessName, ahk_id %this_id%,
if(name != "putty.exe" && name != "kitty.exe"){
notPutty++
id%A_Index%=""
}
}
found := id - notPutty
GuiControl, , Static2, % "found " found " window(s)"
}
else
{
id=""
GuiControl, , Static2, found 0 window(s)
}
Alpha:
GuiControlGet, alpha, ,msctls_trackbar321
Loop, %id%
{
this_id := id%A_Index%
if(id%A_Index% >0){
WinSet, Transparent, %alpha%, ahk_id %this_id%
}
}
return