-
Notifications
You must be signed in to change notification settings - Fork 0
/
note_latex.ahk
74 lines (57 loc) · 1.08 KB
/
note_latex.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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Event ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetKeyDelay 10
preferred_font := ""
^Space::
;check active window
SetTitleMatchMode RegEx
If not WinActive("ahk_exe i)\\onenote\.exe$")
{
Return
}
;block input
BlockInput On
;save clipboard
;cb := ClipboardAll
;copy
Send ^c
;new env
Send ^+!n
Send !{Down}
;latex mode
Send !=
Send Ⓣ
;paste latex
Send ^v
Send {Text}\;
Send ^a
;convert to latex
Send !=
Send {Right}{Enter}
;copy equation
Send {Left} ^a
Send {LShift Down}{Left 2}{LShift Up}
Send ^c
;select page, return, delete
Send ^+a
Send ^{PgUp}
Sleep 20
Send {Delete}
;paste equation
Send ^v
Send {Ctrl}{k}
Send {Right}
;restore clipboard
;Clipboard := cb
;change font
if (preferred_font != "")
{
Send !{Left}{LAlt}hff
Send {text}%preferred_font%
Send {Enter}{Right}{BS}
}
;remove block
BlockInput Off
Return