-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hotkeys.ahk
76 lines (67 loc) · 2.36 KB
/
Hotkeys.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
; Main Hotkey script. This script contains all of the AHK commands for the system
; UTF-8
; cmd /e:on /c
;;;;;;;;;;;;;;;;;;
; Starting Items ;
;;;;;;;;;;;;;;;;;;
#SingleInstance Force ; Force the program to exit if it's already running in another instance
#Hotstring C O ; When you type a Hotstring, it is case sensitive, Omit the char that actuates the hotstring
#Hotstring EndChars `t ; Sets the key to press to actuate a hotstring
SendMode Input
SetWorkingDir %A_ScriptDir%
; If the program is not running as admin, restart as admin
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Show a Toast notification that the listener has started ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TrayTip, AutoHotKey has started and loaded the following file, %A_ScriptName%, 1, 49
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Install a Tray Icon Menu Handler for Auto-start on boot ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InstallFunc := Func("InstallStartupHook")
Menu, Tray, Add, Install Launch On Startup Hook, % InstallFunc
InstallStartupHook(ItemName, ItemPos, MenuName)
{
; Install startup in system registry for current user
ScriptPath := Format("""{1}"" ""{2}""", A_AhkPath, A_ScriptFullPath)
RegWrite, REG_SZ, HKCU\Software\Microsoft\Windows\CurrentVersion\Run, Hotkeys, % ScriptPath
}
;;;;;;;;;;;;
; Includes ;
;;;;;;;;;;;;
; Multicopy and sequential paste
#Include, %A_ScriptDir%\ClipQueue.ahk
; Hotkeys to reload and edit the script
#Include, %A_ScriptDir%\ScriptManagement.ahk
; Snippets to make typing Spanish easier
#Include, %A_ScriptDir%\Spanish.ahk
; Snippets to insert the current time and date
#Include, %A_ScriptDir%\Timestamp.ahk
; Open Source Autocorrect Module
#Include, %A_ScriptDir%\AutoCorrect.ahk
; Personal Data that is secret
#If FileExist("_secrets.ahk")
#Include, %A_ScriptDir%\_secrets.ahk
#If
;;;;;;;;;;;;;;;;;;;;;;;;;
; Hibernate with Hotkey ;
;;;;;;;;;;;;;;;;;;;;;;;;;
^#!F1::
Run *RunAs rundll32.exe powrprof.dll`,SetSuspendState Hibernate
return
;;;;;;;;;;;;
; Snippets ;
;;;;;;;;;;;;
::sci(tm)::science™
::Sci(tm)::Science™