Skip to content
Newer
Older
100644 559 lines (535 sloc) 16 KB
ea5a5e8
adam authored Mar 6, 2007
1 ; Texter
2 ; Author: Adam Pash <adam@lifehacker.com>
3 ; Gratefully adapted several ideas from AutoClip by Skrommel:
4 ; http://www.donationcoder.com/Software/Skrommel/index.html#AutoClip
5cd56c7 - Added thanks/attributed Dustin
adam authored Mar 8, 2007
5 ; Huge thanks to Dustin Luck for his contributions
ea5a5e8
adam authored Mar 6, 2007
6 ; Script Function:
7 ; Designed to implement simple, on-the-fly creation and managment
8 ; of auto-replacing hotstrings for repetitive text
9 ; http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php
4de77f4 0.3 Release!
adam authored Jun 5, 2007
10 SetWorkingDir %A_ScriptDir%
ea5a5e8
adam authored Mar 6, 2007
11 #SingleInstance,Force
12 #NoEnv
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
13 StringCaseSense On
2e65335 - Add option to run at Startup in the Preferences menu
adam authored Mar 6, 2007
14 AutoTrim,off
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
15 SetKeyDelay,-1
ea5a5e8
adam authored Mar 6, 2007
16 SetWinDelay,0
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
17 ;Gosub,UpdateCheck
46d899f Code optimization
dustin authored Jun 18, 2007
18 Gosub,ASSIGNVARS
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
19 Gosub,RESOURCES
ea5a5e8
adam authored Mar 6, 2007
20 Gosub,READINI
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
21 ;EnableTriggers(true)
ea5a5e8
adam authored Mar 6, 2007
22 Gosub,TRAYMENU
6f15dd5 Began integrating Dustin's awesome optimizations with bundles. So far…
adam authored Jun 22, 2007
23 Gosub,BuildActive
66acc37 Pulled chunks of code into separate files in the includes directory p…
adam authored Sep 21, 2007
24
25 ; Autocorrect and autoclose not yet fully implemented
26 ;if AutoCorrect = 1
27 ; Gosub,AUTOCORRECT
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
28 ;if AutoClose = 1
29 ; Gosub,AUTOCLOSE
737b278 Rolled all my changes back to the 0.2 release, added UpdateCheck and …
adam authored May 18, 2007
30
46d899f Code optimization
dustin authored Jun 18, 2007
31 FileRead, EnterKeys, %EnterCSV%
32 FileRead, TabKeys, %TabCSV%
33 FileRead, SpaceKeys, %SpaceCSV%
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
34 FileRead, NoTrigKeys, %NoTrigCSV%
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
35 FileRead, AutocorrectKeys, %AutocorrectCSV%
24c926b More bundles tweaks - Very close to 0.5 release.
adam authored Jun 27, 2007
36 ;Gosub,GetFileList
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
37 ;Goto Start
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
38 ; WinGet PrevWinID, ID, A
39 ; SetTimer, MonitorWindows, 500
40 Starting=1
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
41 Loop
737b278 Rolled all my changes back to the 0.2 release, added UpdateCheck and …
adam authored May 18, 2007
42 {
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
43 ;wait for a matching hotstring
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
44 if (Disable = 1)
b5f7bb0 Fixed/updated disabling Texter through keyboard shortcut or right-cli…
adam authored Sep 27, 2007
45 {
46 continue
47 }
48 if Starting <>
5a6d8f8 Fixed a bug with new trigger mechanism: Hotstrings pairs like a and a…
adam authored Sep 27, 2007
49 {
50 Loop
51 { ;grab input one character at a time looking for a match
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
52 if (Disable = 1)
b5f7bb0 Fixed/updated disabling Texter through keyboard shortcut or right-cli…
adam authored Sep 27, 2007
53 {
54 break
55 }
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
56 Input, UserInput, L1 V M, %EndKeys%
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
57 ;Tooltip, Input received, 10, 10
5a6d8f8 Fixed a bug with new trigger mechanism: Hotstrings pairs like a and a…
adam authored Sep 27, 2007
58 if (SubStr(ErrorLevel, 1, 6) = "EndKey")
59 { ;any end key resets the search for a match
60 PossibleMatch=
61 }
62 else
63 {
64 PossibleMatch=%PossibleMatch%%UserInput%
65 }
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
66 ;Tooltip, PossibleMatch= %PossibleMatch%
5a6d8f8 Fixed a bug with new trigger mechanism: Hotstrings pairs like a and a…
adam authored Sep 27, 2007
67 IfInString, HotStrings, |%PossibleMatch%|
68 { ;found a match - go to trigger search
69 break
70 }
83cca0b - No longer need old MonitorWindows features. Still using to determin…
adam authored Oct 2, 2007
71 } ; end of inside loop
5a6d8f8 Fixed a bug with new trigger mechanism: Hotstrings pairs like a and a…
adam authored Sep 27, 2007
72 }
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
73 PossHexMatch := Hexify(PossibleMatch)
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
74 ;PHMPipe = |%PossHexMatch%|
75 if AutoCorrect = 1
76 {
6ed7beb - Escape key exits prompt (%p) replacements
adam authored Nov 2, 2007
77 IfInString, AutocorrectKeys, |%PossibleMatch%|
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
78 {
79 AutoMatch = 1
80 }
81 else
82 {
83 AutoMatch=
84 }
85 }
86 if (Autocorrect = 1 and AutoMatch = 1)
87 {
88 ;msgbox %autocorrectkeys%
89 ;if PossHexMatch in %AutocorrectKeys%
90 ;{ ;matched in triggerless list
91 ReadFrom = %A_ScriptDir%\Active\Autocorrect\replacements
6ed7beb - Escape key exits prompt (%p) replacements
adam authored Nov 2, 2007
92 Match := Hexify(PossibleMatch)
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
93 ;msgbox %match%
94 if GetKeyState("Shift", "P") ; the following loop prevents the shift key from being stuck, which happens if it's released while the execute thread is in progress
95 {
96 Loop
97 {
98 if GetKeyState("Shift", "P")
99 {
100 continue
101 }
102 else
103 {
104 break
105 }
106 }
107 }
108 ;}
109 }
110 else if PossHexMatch in %NoTrigKeys%
111 {
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
112 Match := PossHexMatch
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
113 ReadFrom = %A_ScriptDir%\Active\replacements
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
114 if GetKeyState("Shift", "P") ; the following loop prevents the shift key from being stuck, which happens if it's released while the execute thread is in progress
115 {
116 Loop
117 {
118 if GetKeyState("Shift", "P")
119 {
120 continue
121 }
122 else
123 {
124 break
125 }
126 }
127 }
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
128 }
129 else
130 { ;get a single character of input to look for triggers
9c6a953 - Fixed Preferences focus (so first hotkey isn't cleared as soon as w…
adam authored Sep 29, 2007
131 Transform, CtrlC, Chr, 3 ; used for the Ctrl-C check
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
132 Input, UserInput, L1 M, %EndKeys%
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
133 ;Tooltip, ErrorLevel= %ErrorLevel%, 10, 10
134 ;msgbox %userinput%
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
135 AltState := GetKeyState("Alt", "P")
136 CtrlState := GetKeyState("Ctrl", "P")
137 ShiftState := GetKeyState("Shift", "P")
138 LWinState := GetKeyState("LWin", "P")
139 RWinState := GetKeyState("RWin", "P")
140 WinState := LWinState || RWinState
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
141 Modifier=
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
142 if (AltState || CtrlState || WinState || ShiftState)
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
143 {
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
144 if AltState
145 {
146 Modifier = !
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
147 PossibleMatch=
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
148 }
149 if CtrlState
150 {
151 Modifier = %Modifier%^
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
152 PossibleMatch=
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
153 }
154 if ShiftState
155 {
156 Modifier = %Modifier%+
157 }
158 if WinState
159 {
160 Modifier = %Modifier%#
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
161 PossibleMatch=
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
162 }
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
163 }
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
164 if (SubStr(ErrorLevel, 1, 6) = "EndKey")
165 { ;trigger found
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
166 Trigger := SubStr(ErrorLevel, 8)
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
167 if (Trigger = "Backspace")
168 { ; trim possmatch so trigger still works if miskeyed
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
169 Send %Modifier%{BS}
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
170 StringTrimRight, PossibleMatch, PossibleMatch, 1
171 continue
172 }
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
173 Bank = %Trigger%Keys
174 Bank := %Bank%
175 PossHexMatch := Hexify(PossibleMatch)
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
176 if PossHexMatch in %Bank%
177 { ;hotstring/trigger match
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
178 ReadFrom = %A_ScriptDir%\Active\replacements
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
179 Match := PossHexMatch
180 }
181 else
182 {
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
183 if (AltState && !CtrlState && !ShiftState && !WinState)
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
184 {
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
185 ;Msgbox alt alone
186 if AltState
187 {
188 Send, {Alt Down}`{%Trigger%`}
189 AltState := GetKeyState("Alt", "P")
190 Loop
191 {
192 if AltState
193 {
194 AltState := GetKeyState("Alt", "P")
195 }
196 else
197 {
198 Send, {Alt Up}
199 break
200 }
201 }
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
202 PossibleMatch=
203 Starting=1
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
204 continue
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
205 }
206 }
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
207 else if (AltState || CtrlState || WinState || ShiftState)
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
208 {
209 ;msgbox not alone: %modifier%
210 Send, %Modifier%`{%Trigger%`}
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
211 PossibleMatch=
212 Starting=1
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
213 continue
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
214 }
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
215 else
216 {
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
217 ;MsgBox %Trigger%
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
218 Send, `{%Trigger%`}
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
219 ;msgbox sent trigger
220 PossibleMatch=
221 Starting=1
222 continue
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
223 }
224 ;MsgBox, Trigger=%Trigger%
225 }
226 }
227 }
228 if Match<>
229 {
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
230 ;msgbox %possiblematch%
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
231 GoSub, EXECUTE
232 PossibleMatch=
233 PossHexMatch=
234 Match=
b5f7bb0 Fixed/updated disabling Texter through keyboard shortcut or right-cli…
adam authored Sep 27, 2007
235 Starting=1
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
236 continue
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
237 }
238 else
239 {
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
240 if AltState
241 {
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
242 Send, {Alt Down}%UserInput%
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
243 AltState := GetKeyState("Alt", "P")
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
244 Loop
245 {
246 if AltState
247 {
248 AltState := GetKeyState("Alt", "P")
249 }
250 else
251 {
252 Send, {Alt Up}
253 break
254 }
255 }
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
256 }
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
257 else if UserInput = %CtrlC% ; this doesn't seem like the best fix, but Ctrl-C was not working correctly w/out
258 { ; all other modifiers + letters seem to be working fine
259 SendInput, ^c
260 PossibleMatch=
261 Starting=1
262 ;msgbox boom hi there
263 continue
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
264 }
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
265 ; else if (Modifier <> && !ShiftState) ;is this even doing anything anymore?
266 ; {
267 ; SendInput,%Modifier%%UserInput%
268 ; msgbox sending
269 ; PossibleMatch=
270 ; Starting=1
271 ; continue
272 ; }
273 ;msgbox sending %userinput%
274 PossibleMatch=%PossibleMatch%%UserInput%
275 ;Tooltip, PossibleMatch= %PossibleMatch%
276 SendRaw, %UserInput% ; SendRaw ensures special characters like #, !, {}, etc. are interpreted and sent correctly
277 Starting=
278 Modifier=
279
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
280 }
d57b62d - Fixed more modifier bugs
adam authored Oct 17, 2007
281
737b278 Rolled all my changes back to the 0.2 release, added UpdateCheck and …
adam authored May 18, 2007
282 }
ea5a5e8
adam authored Mar 6, 2007
283 return
284
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
285 ;~$BS::StringTrimRight, PossibleMatch, PossibleMatch, 1
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
286
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
287
ea5a5e8
adam authored Mar 6, 2007
288 EXECUTE:
24c926b More bundles tweaks - Very close to 0.5 release.
adam authored Jun 27, 2007
289 WinGetActiveTitle,thisWindow ; this variable ensures that the active Window is receiving the text, activated before send
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
290 ;; below added b/c SendMode Play appears not to be supported in Vista
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
291 ;EnableTriggers(false)
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
292 if (A_OSVersion = "WIN_VISTA") or (Synergy = 1)
7da67b5 0.3 release fix, made compatible for Vista, which appears not to acce…
adam authored Jun 5, 2007
293 SendMode Input
294 else
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
295 SendMode Play ; Set an option in Preferences to enable for use with Synergy - Use SendMode Input to work with Synergy
296 if (ExSound = 1)
46d899f Code optimization
dustin authored Jun 18, 2007
297 SoundPlay, %ReplaceWAV%
ea5a5e8
adam authored Mar 6, 2007
298 ReturnTo := 0
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
299 hexInput:=Dehexify(Match)
24c926b More bundles tweaks - Very close to 0.5 release.
adam authored Jun 27, 2007
300 StringLen,BSlength,hexInput
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
301 Send, {BS %BSlength%}
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
302 FileRead, ReplacementText, %ReadFrom%\%Match%.txt
6ed7beb - Escape key exits prompt (%p) replacements
adam authored Nov 2, 2007
303 ;msgbox %hexinput%
4de77f4 0.3 Release!
adam authored Jun 5, 2007
304 StringLen,ClipLength,ReplacementText
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
305
306 IfInString,ReplacementText,::scr::
ea5a5e8
adam authored Mar 6, 2007
307 {
589e77c - Improvement to READINI thread, code optimization, and ESC to cancel…
adam authored Mar 8, 2007
308 ;To fix double spacing issue, replace `r`n (return + new line) as AHK sends a new line for each character
309 StringReplace,ReplacementText,ReplacementText,`r`n,`n, All
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
310 StringReplace,ReplacementText,ReplacementText,::scr::,,
311 IfInString,ReplacementText,`%p
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
312 {
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
313 textPrompt(ReplacementText)
6ed7beb - Escape key exits prompt (%p) replacements
adam authored Nov 2, 2007
314 if escapePrompt = 1
315 {
316 Exit
317 }
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
318 }
319 IfInString,ReplacementText,`%s
320 {
321 StringReplace, ReplacementText, ReplacementText,`%s(, ¢, All
322 Loop,Parse,ReplacementText,¢
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
323 {
324 if (A_Index != 1)
325 {
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
326 StringGetPos,len,A_LoopField,)
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
327 StringTrimRight,sleepTime,A_LoopField,%len%
328 StringMid,thisScript,A_LoopField,(len + 2),
329 Sleep,%sleepTime%
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
330 ;WinActivate,%thisWindow% The assumption must be made that in script mode
331 ; the user can intend to enter text in other windows
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
332 SendInput,%thisScript%
333 }
334 else
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
335 {
336 ;WinActivate,%thisWindow% The assumption must be made that in script mode
337 ; the user can intend to enter text in other windows
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
338 SendInput,%A_LoopField%
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
339 }
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
340 }
341 }
342 else
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
343 SendInput,%ReplacementText%
ea5a5e8
adam authored Mar 6, 2007
344 return
345 }
346 else
347 {
589e77c - Improvement to READINI thread, code optimization, and ESC to cancel…
adam authored Mar 8, 2007
348 ;To fix double spacing issue, replace `r`n (return + new line) as AHK sends a new line for each character
349 ;(but only in compatibility mode)
350 if MODE = 0
351 {
352 StringReplace,ReplacementText,ReplacementText,`r`n,`n, All
353 }
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
354 IfInString,ReplacementText,`%c
355 {
356 StringReplace, ReplacementText, ReplacementText, `%c, %Clipboard%, All
357 }
358 IfInString,ReplacementText,`%t
359 {
360 FormatTime, CurrTime, , Time
361 StringReplace, ReplacementText, ReplacementText, `%t, %CurrTime%, All
362 }
363 IfInString,ReplacementText,`%ds
364 {
365 FormatTime, SDate, , ShortDate
366 StringReplace, ReplacementText, ReplacementText, `%ds, %SDate%, All
367 }
368 IfInString,ReplacementText,`%dl
ea5a5e8
adam authored Mar 6, 2007
369 {
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
370 FormatTime, LDate, , LongDate
371 StringReplace, ReplacementText, ReplacementText, `%dl, %LDate%, All
ea5a5e8
adam authored Mar 6, 2007
372 }
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
373 IfInString,ReplacementText,`%p
374 {
375 textPrompt(ReplacementText)
6ed7beb - Escape key exits prompt (%p) replacements
adam authored Nov 2, 2007
376 if escapePrompt = 1
377 {
378 return
379 }
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
380 }
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
381 IfInString,ReplacementText,`%|
ea5a5e8
adam authored Mar 6, 2007
382 {
a037f11 - Hopefully finalized 0.2 release of Texter - included another change…
adam authored Mar 9, 2007
383 ;in clipboard mode, CursorPoint & ClipLength need to be calculated after replacing `r`n
384 if MODE = 0
385 {
386 MeasurementText := ReplacementText
387 }
388 else
389 {
390 StringReplace,MeasurementText,ReplacementText,`r`n,`n, All
391 }
392 StringGetPos,CursorPoint,MeasurementText,`%|
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
393 StringReplace, ReplacementText, ReplacementText, `%|,, All
a037f11 - Hopefully finalized 0.2 release of Texter - included another change…
adam authored Mar 9, 2007
394 StringReplace, MeasurementText, MeasurementText, `%|,, All
395 StringLen,ClipLength,MeasurementText
ea5a5e8
adam authored Mar 6, 2007
396 ReturnTo := ClipLength - CursorPoint
397 }
a037f11 - Hopefully finalized 0.2 release of Texter - included another change…
adam authored Mar 9, 2007
398
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
399 if MODE = 0
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
400 {
401 if ReturnTo > 0
402 {
cb921cf - 0.4 Release
adam authored Jun 17, 2007
403 if ReplacementText contains !,#,^,+,{
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
404 {
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
405 WinActivate,%thisWindow%
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
406 SendRaw, %ReplacementText%
407 Send,{Left %ReturnTo%}
408 }
409 else
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
410 {
411 WinActivate,%thisWindow%
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
412 Send,%ReplacementText%{Left %ReturnTo%}
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
413 }
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
414 }
415 else
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
416 {
417 WinActivate,%thisWindow%
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
418 SendRaw,%ReplacementText%
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
419 }
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
420 }
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
421 else
422 {
423 oldClip = %Clipboard%
424 Clipboard = %ReplacementText%
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
425 if ReturnTo > 0
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
426 {
427 WinActivate,%thisWindow%
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
428 Send,^v{Left %ReturnTo%}
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
429 }
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
430 else
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
431 {
432 WinActivate,%thisWindow%
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
433 Send,^v
49918b3 - Added prompts, tweaked delay
adam authored Jun 13, 2007
434 }
8f1b2ca - Incorporated Dustin's date/time variables
adam authored Mar 6, 2007
435 Clipboard = %oldClip%
436 }
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
437 ; if ReturnTo > 0
438 ; Send, {Left %ReturnTo%}
ee2ff17
adam authored Jul 3, 2007
439
ea5a5e8
adam authored Mar 6, 2007
440 }
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
441 SendMode Event
4de77f4 0.3 Release!
adam authored Jun 5, 2007
442 IniRead,expanded,texter.ini,Stats,Expanded
443 IniRead,chars_saved,texter.ini,Stats,Characters
444 expanded += 1
445 chars_saved += ClipLength
446 IniWrite,%expanded%,texter.ini,Stats,Expanded
447 IniWrite,%chars_saved%,texter.ini,Stats,Characters
ea5a5e8
adam authored Mar 6, 2007
448 Return
449
450 HOTKEYS:
451 StringTrimLeft,hotkey,A_ThisHotkey,1
452 StringLen,hotkeyl,hotkey
453 If hotkeyl>1
454 hotkey=`{%hotkey%`}
455 Send,{SC77}
456 Return
457
46d899f Code optimization
dustin authored Jun 18, 2007
458 ASSIGNVARS:
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
459 Version = 0.6
6f15dd5 Began integrating Dustin's awesome optimizations with bundles. So far…
adam authored Jun 22, 2007
460 EnterCSV = %A_ScriptDir%\Active\bank\enter.csv
461 TabCSV = %A_ScriptDir%\Active\bank\tab.csv
462 SpaceCSV = %A_ScriptDir%\Active\bank\space.csv
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
463 NoTrigCSV = %A_ScriptDir%\Active\bank\notrig.csv
6ed7beb - Escape key exits prompt (%p) replacements
adam authored Nov 2, 2007
464 AutocorrectCSV = %A_ScriptDir%\Active\Autocorrect\pipelist.txt
46d899f Code optimization
dustin authored Jun 18, 2007
465 ReplaceWAV = %A_ScriptDir%\resources\replace.wav
466 TexterPNG = %A_ScriptDir%\resources\texter.png
467 TexterICO = %A_ScriptDir%\resources\texter.ico
468 StyleCSS = %A_ScriptDir%\resources\style.css
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
469 Throbber = %A_ScriptDir%\resources\throbber.gif
685e969 - Changed the Special Key to vkFF, which shouldn't inadvertently fire…
adam authored Sep 28, 2007
470 SpecialKey = vkFF
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
471 EndKeys={Enter}{Esc} {Tab}{Right}{Left}{Up}{Down}{Del}{BS}{Home}{End}{PgUp}{PgDn}{%SpecialKey%}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}
b5f7bb0 Fixed/updated disabling Texter through keyboard shortcut or right-cli…
adam authored Sep 27, 2007
472 Disable = 0
46d899f Code optimization
dustin authored Jun 18, 2007
473 return
474
24c926b More bundles tweaks - Very close to 0.5 release.
adam authored Jun 27, 2007
475 READINI:
a468ecd Use variable for version number - only one place to change for future…
dustin authored Jun 22, 2007
476 IniWrite,%Version%,texter.ini,Preferences,Version
859e128 - Implemented disable via global hotkey
adam authored Jul 18, 2007
477 IniWrite,0,texter.ini,Settings,Disable
589e77c - Improvement to READINI thread, code optimization, and ESC to cancel…
adam authored Mar 8, 2007
478 cancel := GetValFromIni("Cancel","Keys","{Escape}") ;keys to stop completion, remember {}
479 ignore := GetValFromIni("Ignore","Keys","{Tab}`,{Enter}`,{Space}") ;keys not to send after completion
698eb1e - Optimized Texter so it's more likely to work as expected - Left Mou…
adam authored May 22, 2007
480 IniWrite,{Escape}`,{Tab}`,{Enter}`,{Space}`,{Left}`,{Right}`,{Up}`,{Down},texter.ini,Autocomplete,Keys
481 keys := GetValFromIni("Autocomplete","Keys","{Escape}`,{Tab}`,{Enter}`,{Space}`,{Left}`,{Right}`,{Esc}`,{Up}`,{Down}")
589e77c - Improvement to READINI thread, code optimization, and ESC to cancel…
adam authored Mar 8, 2007
482 otfhotkey := GetValFromIni("Hotkey","OntheFly","^+H")
76f8178 Another 0.4 release - fixed a few bugs
adam authored Jun 17, 2007
483 managehotkey := GetValFromIni("Hotkey","Management","^+M")
859e128 - Implemented disable via global hotkey
adam authored Jul 18, 2007
484 disablehotkey := GetValFromIni("Hotkey", "Disable","")
589e77c - Improvement to READINI thread, code optimization, and ESC to cancel…
adam authored Mar 8, 2007
485 MODE := GetValFromIni("Settings","Mode",0)
486 EnterBox := GetValFromIni("Triggers","Enter",0)
487 TabBox := GetValFromIni("Triggers","Tab",0)
488 SpaceBox := GetValFromIni("Triggers","Space",0)
fa58cee - Made *some* SendPlay/SendInput improvements. Would still like SendI…
adam authored Jun 8, 2007
489 ExSound := GetValFromIni("Preferences","ExSound",1)
490 Synergy := GetValFromIni("Preferences","Synergy",0)
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
491 Autocorrect := GetValFromIni("Preferences","AutoCorrect",1)
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
492 Default := GetValFromIni("Bundles","Default",1)
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
493 OnStartup := GetValFromIni(Settings, Startup, 0)
399f93d - Fixed a couple of minor bugs in 0.2 after testing
adam authored Mar 8, 2007
494
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
495
496
497
4de77f4 0.3 Release!
adam authored Jun 5, 2007
498 ;; Enable hotkeys for creating new keys and managing replacements
499 if otfhotkey <>
e51f463
adam authored Jun 17, 2007
500 {
501 Hotkey,IfWinNotActive,Texter Preferences
502 Hotkey,%otfhotkey%,NEWKEY
503 Hotkey,IfWinActive
504 }
4de77f4 0.3 Release!
adam authored Jun 5, 2007
505 if managehotkey <>
e51f463
adam authored Jun 17, 2007
506 {
507 Hotkey,IfWinNotActive,Texter Preferences
4de77f4 0.3 Release!
adam authored Jun 5, 2007
508 Hotkey,%managehotkey%,MANAGE
e51f463
adam authored Jun 17, 2007
509 Hotkey,IfWinActive
698eb1e - Optimized Texter so it's more likely to work as expected - Left Mou…
adam authored May 22, 2007
510 }
b7a1050 Printable css sheet, new SendPlay/SendInput modes used
adam authored Jun 1, 2007
511
859e128 - Implemented disable via global hotkey
adam authored Jul 18, 2007
512 if disablehotkey <>
513 {
514 Hotkey,IfWinNotActive,Texter Preferences
515 Hotkey,%disablehotkey%,DISABLE
516 Hotkey,IfWinActive
517 }
518
83cca0b - No longer need old MonitorWindows features. Still using to determin…
adam authored Oct 2, 2007
519 ~LButton::PossibleMatch=
520 ~RButton::PossibleMatch=
521 ~MButton::PossibleMatch=
ea5a5e8
adam authored Mar 6, 2007
522
66acc37 Pulled chunks of code into separate files in the includes directory p…
adam authored Sep 21, 2007
523 ; GUI
524 #Include includes\GUI\newkey_GUI.ahk ; the GUI for new on-the-fly hotstring creation
525 #Include includes\GUI\traymenu_GUI.ahk ; Builds the right-click system tray menu
526 #Include includes\GUI\about_GUI.ahk ; About Texter GUI window
527 #Include includes\GUI\help_GUI.ahk ; Help dialog/window
528 #Include includes\GUI\preferences_GUI.ahk ; Preferences GUI and accept/cancel threads
529 #Include includes\GUI\management_GUI.ahk ; Implementation of the hotstring management GUI
530 #Include includes\GUI\textprompt_GUI.ahk ; GUI that prompts for text when %p operator is included
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
531 #Include includes\GUI\disablechecks.ahk ; Keeps instant exclusive from tab, enter, and space keys (greys out others)
532
66acc37 Pulled chunks of code into separate files in the includes directory p…
adam authored Sep 21, 2007
533
534 ; Functions
535 #Include includes\functions\disable.ahk ; Disable/enable Texter... need to check if this is still in use (not sure it is)
536 #Include includes\functions\urls.ahk ; Links to Texter homepage and usage instructions
537 #Include includes\functions\getfilelist.ahk ; Loops the main %A_ScriptDir%\replacements\*.txt dir and gathers the list of replacements
538 #Include includes\functions\buildactive.ahk ; Loops the enabled bundles and builds the active set of replacements in Active\replacements\ and Active\replacements
539 #Include includes\functions\bundles.ahk ; Implementation for working with bundles in the management GUI
540 #Include includes\functions\getvalfromini.ahk ; method for writing to ini
541 #Include includes\functions\savehotstring.ahk ; method for saving a new hotstring
542 #Include includes\functions\addtobank.ahk ; method for adding a new hotstring to the bank list of replacements
543 #Include includes\functions\delfrombank.ahk ; method for deleting a hotstring to the bank list of replacements
544 #Include includes\functions\enabletriggers.ahk ; method for enabling/disabling Texter
545 #Include includes\functions\resources.ahk ; Installs file resources like images and sounds
546 #Include includes\functions\printablelist.ahk ; Builds Texter Replacement Guide HTML file
547 #Include includes\functions\updatecheck.ahk ; If enabled, checks for updates to Texter on startup
9c9a5e9 - Adjusted the modifier keys so that they compensate for modifier com…
adam authored Sep 28, 2007
548 ; #Include includes\functions\hexall.ahk ; Converts pre-0.5 version of Texter to the new hexified replacement format... may remove in future versions
66acc37 Pulled chunks of code into separate files in the includes directory p…
adam authored Sep 21, 2007
549 #Include includes\functions\hexify.ahk ; Translates back and forth between hex values for replacements
9bb3b76 Included Dustin's InsSpecKeys.ahk function for special key insertion …
adam authored Sep 26, 2007
550 #Include includes\functions\InsSpecKeys.ahk ; Insert special characters in Texter script mode by pressing insert and then the special key
e8ca640 Incorporated Dustin's new and improved triggering method. Status: wor…
adam authored Sep 27, 2007
551 #Include includes\functions\MonitorWindows.ahk ; monitors active window and clears input when window switches
39d3bda - Add autocorrect files with a fileinstall
adam authored Oct 27, 2007
552 #include includes\functions\renameHotstring.ahk ; rename hotstrings in the Texter Management GUI via the right-click context menu
553 #include includes\functions\InstallAutocorrect.ahk ; sets up autocorrect folder when Texter is first run
66acc37 Pulled chunks of code into separate files in the includes directory p…
adam authored Sep 21, 2007
554
8d1972c - Lots of small fixes, including GUI fixes for instant replacements
adam authored Oct 16, 2007
555 ;#Include includes\functions\autocorrect.ahk ; Spelling autocorrect--may implement in 0.6
66acc37 Pulled chunks of code into separate files in the includes directory p…
adam authored Sep 21, 2007
556 ; #Include includes\functions\autoclose.ahk ; Automatically closes bracketed puntuation, like parentheticals - not currently implemented
24c926b More bundles tweaks - Very close to 0.5 release.
adam authored Jun 27, 2007
557
ea5a5e8
adam authored Mar 6, 2007
558 EXIT:
559 ExitApp
Something went wrong with that request. Please try again.