-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lcuts_b.ahk
304 lines (262 loc) · 7.26 KB
/
Lcuts_b.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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#InstallKeybdHook ; to detect pressed keys
#InstallMouseHook ; to detect clicks
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;Tray menu
Menu, Tray, Icon, Lcuts.ico ;Load icon
Menu, Tray, Tip, Luiz cuts ;Change display name
;Contextual menu
Menu, MainMenu, Add, Help, MenuHandler
Menu, MainMenu, Icon, Help, Lcuts.ico ;Load icon
Menu, MainMenu, Add, Outlook, MenuHandler
Menu, MainMenu, Add, Slack, MenuHandler
Menu, MainMenu, Add, Salamander, MenuHandler
Menu, MainMenu, Add, Jira Board, MenuHandler
Menu, MainMenu, Add, Jira Filters, MenuHandler
Menu, MainMenu, Add, Confluence NR, MenuHandler
;Menu, MainMenu, Add, Reminder, MenuHandler
Menu, ReminderMenu, Add, 5 minutes, MenuHandler
Menu, ReminderMenu, Add, 30 minutes, MenuHandler
Menu, ReminderMenu, Add, 2 hours, MenuHandler
Menu, MainMenu, Add, Reminder, :ReminderMenu
;Set Lock keys permanently
SetNumlockState, AlwaysOn
;SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
oReminder := new Ant( 10000 ) ;every 10 seconds
Return
Numpad1::DisplayHelp()
Numpad2::SwitchStartP("chrome.exe")
Numpad3::SwitchStartP("excel.exe")
;+Capslock::SwitchStartP("C:\Program Files\Altap Salamander\salamand.exe")
;Capslock::SwitchOutlookSlack()
MButton::#Tab
Appskey & f::
{
Send, ^c
Clipwait
Run, "C:\Program Files\Mozilla Firefox\Firefox.exe" https://duckduckgo.com/?q="%clipboard%"
Return
}
Appskey & t::
{
Send, ^c
Clipwait
Run, "C:\Program Files\Mozilla Firefox\Firefox.exe" https://translate.google.com/#auto/en/"%clipboard%"
return
}
;Appskey::WinMinimize, A
;Appskey::
;{
; ;#5: Retrieves a list of running processes via COM:
; Gui, Add, ListView, x2 y0 w400 h500, Process Name|Command Line
; for proc in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process")
; LV_Add("", proc.Name, proc.CommandLine)
; Gui, Show,, Process List
;
; ; Win32_Process: http://msdn.microsoft.com/en-us/library/aa394372.aspx
;}
;Appskey::
;{
; ;This will visit all windows on the entire system and display info about each of them:
; WinGet, id, list,,, Program Manager
; Loop, %id%
; {
; this_id := id%A_Index%
; ;WinActivate, ahk_id %this_id%
; ;WinGetClass, this_class, ahk_id %this_id%
; WinGetTitle, this_title, ahk_id %this_id%
;
; if strlen(this_title) > 0
; {
; ;MsgBox, 4, , Visiting All Windows`n%index% of %id%`id: %this_id%`nclass: %this_class%`ntitle: %this_title%`n`nContinue?
; MsgBox, 4, , Visiting All Windows`ntitle: %this_title%`n`nContinue?
; IfMsgBox, NO, break
; }
; }
; Return
;}
Appskey::
{
WinGetActiveTitle, Title
MsgBox, The active window is "%Title%".
}
;Appskey::
; Menu, MainMenu, Show
;Return
MenuHandler:
{
if A_ThisMenuItem = Help
{
DisplayHelp()
}
else if A_ThisMenuItem = Outlook
{
SwitchStartP("outlook.exe", True)
}
else if A_ThisMenuItem = Slack
{
SwitchStartPW("C:\Users\l.maia\AppData\Local\slack\slack.exe", "slack.exe")
}
else if A_ThisMenuItem = Salamander
{
SwitchStartP("C:\Program Files\Altap Salamander\salamand.exe")
}
else if A_ThisMenuItem = Jira Board
{
Run, chrome.exe http://msdn.microsoft.com/en-us/library/aa394372.aspx
}
else if A_ThisMenuItem = Jira Filters
{
Run, chrome.exe http://msdn.microsoft.com/en-us/library/aa394372.aspx
}
else if A_ThisMenuItem = Confluence NR
{
Run, chrome.exe http://msdn.microsoft.com/en-us/library/aa394372.aspx
}
else if A_ThisMenuItem = 5 minutes
{
InputBox, UserInput, Reminder, What do you want to be reminded of?, , , 100
oReminder := new Elephant( 5 * 60000, UserInput )
}
else if A_ThisMenuItem = 30 minutes
{
InputBox, UserInput, Reminder, What do you want to be reminded of?, , , 100
oReminder := new Elephant( 30 * 60000, UserInput )
}
else if A_ThisMenuItem = 2 hours
{
InputBox, UserInput, Reminder, What do you want to be reminded of?, , , 100
oReminder := new Elephant( 2 * 60 * 60000, UserInput )
}
Return
}
;===================
;= HISTORY =
;===================
Numpad5::KeyHistory
;===================
;= FUNCTIONS =
;===================
SwitchStartP(sProgramToStart, bWait:=False)
{
sSearchWindow := "ahk_exe " . sProgramToStart
SwitchStartPW(sProgramToStart, sSearchWindow, bWait)
}
SwitchStartPW(sProgramToStart, sSearchWindow, bWait:=False)
{
if WinExist(sSearchWindow)
{
WinActivate, %sSearchWindow%
;Traytip, Window, Switched to %sProgramToStart%, 0.5, 1
}
else
{
Run, %sProgramToStart%
;Traytip, Window, Launched %sProgramToStart%, 0.5, 1
}
if(bWait = True)
WinWaitActive, %sSearchWindow%
Return
}
SwitchOutlookSlack()
{
static iComm := 1
if(iComm = 1)
{
SwitchStartP("outlook.exe", True)
iComm = 2
}
else
{
SwitchStartPW("C:\Users\l.maia\AppData\Local\slack\slack.exe", "slack.exe")
iComm = 1
}
Return
}
SwitchMouseSensitivity()
{
static iSensitivity := 20
sSensitivity = low
if(iSensitivity = 20)
iSensitivity = 3
else
{
iSensitivity = 20
sSensitivity = high
}
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,iSensitivity, Int,2)
Traytip, Mouse, Sensitivity set to %sSensitivity%, 0.5, 1
Return
}
DisplayHelp()
{
Traytip, LCuts help, Capslock: Outlook and Slack`nShift+Capslock:Salamander`nNumPad2:Chrome`nNumPad3:Excel, 0.5, 1
}
class Elephant
{
__New( aWhen, aWhat )
{
this.period := aWhen
this.what := aWhat
this.timer := ObjBindMethod(this, "Expire")
timer := this.timer
SetTimer % timer, % this.period
}
Expire()
{
timer := this.timer
SetTimer % timer, Off
MsgBox % "You asked to be reminded of: " . this.what
}
}
class Ant
{
__New( aWhen, aWhat )
{
this.period := aWhen
this.timer := ObjBindMethod(this, "Tick")
timer := this.timer
SetTimer % timer, % this.period
}
Tick()
{
WinGetActiveTitle, Title
FormatTime, CurrentDateTime,, dd/MM/yy
aWhen = this.period
FileAppend, (%Title%, %aWhen%, %CurrentDateTime%), C:\Users\l.maia\Documents\usage_log.csv
;MsgBox % "You asked to be reminded of: " . this.what
}
}
;Counter class
class SecondCounter
{
__New( aInterval )
{
this.interval := aInterval
this.count := 0
; Tick() has an implicit parameter "this" which is a reference to the object, so we need to create a function which encapsulates "this" and the method to call:
this.timer := ObjBindMethod(this, "Tick")
; Known limitation: SetTimer requires a plain variable reference.
timer := this.timer
SetTimer % timer, % this.interval
ToolTip % "Counter started"
}
__Delete()
{
}
Stop()
{
; To turn off the timer, we must pass the same object as before:
timer := this.timer
SetTimer % timer, Off
ToolTip % "Counter stopped at " this.count
}
; In this example, the timer calls this method:
Tick()
{
ToolTip % ++this.count
}
}