-
Notifications
You must be signed in to change notification settings - Fork 2
/
ms_word.ahk
214 lines (198 loc) · 7.7 KB
/
ms_word.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
;#################################################################
;##### CfK -- App -- MS Word
;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr
#IfWinActive ahk_class OpusApp
; Strg+Shift+w = Toogle warning on saving documents with comments
; "Vor dem Drucken, Speichern oder Senden einer Datei mit Überarbeitungen"
; "oder Kommentaren warnen"
^+w::
msoTrue := -1
msoFalse := 0
try {
word := ComObjActive("Word.Application")
show_warning := word.Options.WarnBeforeSavingPrintingSendingMarkup
if (show_warning == msoTrue) {
word.Options.WarnBeforeSavingPrintingSendingMarkup := msoFalse
ShowtoolTip("Show warning before saving: NO", 2000)
} else {
word.Options.WarnBeforeSavingPrintingSendingMarkup := msoTrue
ShowtoolTip("Show warning before saving: YES", 2000)
}
}
return
; EDIT TEXT MODE ----------------------------------------------------------
; Strg+Shift+e = Toggle track changes
^+e::
try {
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
; .TrackMoves
; .TrackFormatting
if (bTrackChanges == -1) { ; -1 = msoTrue
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
ShowtoolTip("Track changes: NO", 2000)
} else {
oWordDoc.TrackRevisions := -1 ; -1 = msoTrue
ShowtoolTip("Track changes: YES", 2000)
}
}
return
; Strg+Shift+r = Toggle Markups show/hide
^+r::
try {
oWordView := ComObjActive("Word.Application").ActiveWindow.View
oWordView.RevisionsView := 0 ; 0 = wdRevisionsViewFinal
;oWordView.MarkupMode := 0 ; 0 = wdBalloonRevisions
if (oWordView.ShowRevisionsAndComments == -1) { ; -1 = msoTrue
oWordView.ShowRevisionsAndComments := 0 ; 0 = msoFalse
ShowtoolTip("Markups visible: NO", 2000)
} else {
oWordView.ShowRevisionsAndComments := -1 ; -1 = msoTrue
ShowtoolTip("Markups visible: YES", 2000)
}
}
return
; HIGHLIGHT TEXT ----------------------------------------------------------
; https://msdn.microsoft.com/en-us/library/office/ff195343.aspx enum WdColorIndex
; 0 = wdNoHighlight, 4 = wdBrightGreen, 7 = wdYellow, 6 = wdRed, 5 = wdPink,
; Strg+Shift+y = Highlight/Markierung löschen
^+y::
try {
; stop tracking changes (if tracked)
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
; remove highlight from text
ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 0 ; 0 = wdNoHighlight
; restore tracking changes status
oWordDoc.TrackRevisions := bTrackChanges
}
return
; Strg+Shift+x = Gelb markieren
^+x::
try {
; stop tracking changes (if tracked)
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
; highlight text
ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 7 ; 7 = wdYellow
; restore tracking changes status
oWordDoc.TrackRevisions := bTrackChanges
}
return
; Strg+Shift+c= Magenta markieren
^+c::
try {
; stop tracking changes (if tracked)
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
; highlight text
ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 5 ; 5 = wdPink
; restore tracking changes status
oWordDoc.TrackRevisions := bTrackChanges
}
return
; Strg+Shift+v = Grün markieren
^+v::
try {
; stop tracking changes (if tracked)
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
; highlight text
ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 4 ; 4 = wdBrightGreen
; restore tracking changes status
oWordDoc.TrackRevisions := bTrackChanges
}
return
; Strg+Shift+b = Türkis markieren
^+b::
try {
; stop tracking changes (if tracked)
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
; highlight text
ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 3 ; 3 = wdTurquoise
; restore tracking changes status
oWordDoc.TrackRevisions := bTrackChanges
}
return
; Strg+Shift+n = Rot markieren
^+n::
try {
; stop tracking changes (if tracked)
oWordDoc := ComObjActive("Word.Application").ActiveDocument
bTrackChanges := oWordDoc.TrackRevisions
oWordDoc.TrackRevisions := 0 ; 0 = msoFalse
; highlight text
ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 6 ; 6 = wdRed
; restore tracking changes status
oWordDoc.TrackRevisions := bTrackChanges
}
return
; INSERT / DELETE ---------------------------------------------------------
; Strg+m = Paste as text only
^m::
try {
ComObjActive("Word.Application").Selection.PasteSpecial(ComObjMissing(),ComObjMissing(),0,ComObjMissing(),2) ; 0 = wdInLine; 2 = wdPasteText
}
return
; Strg+b = Paste as emf
^b::
try {
ComObjActive("Word.Application").Selection.PasteSpecial(ComObjMissing(),ComObjMissing(),0,ComObjMissing(),9) ; 0 = wdInLine; 9 = wdPasteEnhancedMetafile
}
return
; Strg+n = Paste as png
^n::
try {
ComObjActive("Word.Application").Selection.PasteSpecial(ComObjMissing(),ComObjMissing(),0,ComObjMissing(),14) ; 0 = wdInLine; 14 = wdPastePNG
}
return
; Strg+Space = Insert thin (not breakable) space U+2009 / 8201 (dezimal)
; Word: 2009{ALT}{C}
^Space::
msoTrue := -1
try {
ComObjActive("Word.Application").Selection.InsertSymbol(0x2009, "", msoTrue)
}
return
; Strg+Super++(Numpad) = Zeile in Word-Tabelle unterhalb hinzufügen
^#NumpadAdd::
try {
ComObjActive("Word.Application").Selection.InsertRowsBelow(1)
}
return
; Strg+Super+-(Numpad) = Aktuelle Zeile in Word-Tabelle löschen
^#NumpadSub::
try {
ComObjActive("Word.Application").Selection.Rows.Delete()
}
return
; Strg+Shift+l = Toggle German/English auto correction
^+l::
wdGerman := 1031
wdEnglishUK := 2057
wdEnglishUS := 1033
try {
oSelection := ComObjActive("Word.Application").Selection
iNewLangID := (oSelection.LanguageID = wdGerman) ? wdEnglishUS : wdGerman
oSelection.LanguageID := iNewLangID
ShowToolTip((iNewLangID = wdGerman) ? "Deutsch" : "English", 1500)
}
return
; Strg+Shift+Super+l = Toggle spellchecking
^+#l::
msoTrue := -1
msoFalse := 0
try {
oSelection := ComObjActive("Word.Application").Selection
iNewProofing := (oSelection.NoProofing = msoFalse) ? msoTrue : msoFalse
oSelection.NoProofing := iNewProofing
ShowToolTip((iNewProofing = msoFalse) ? "Spellchecking: YES" : "Spellchecking: NO", 1500)
}
return
#IfWinActive