├── CurrentVersion.txt ├── README.md ├── Releases ├── 0.1 │ ├── TexterInstaller.ahk │ ├── TexterInstaller.exe │ ├── resources │ │ ├── oldreplace.wav │ │ ├── replace.wav │ │ ├── texter.ico │ │ └── texter48x48.png │ ├── texter.ahk │ └── texter.exe ├── 0.2 │ ├── TexterInstaller.ahk │ ├── TexterInstaller.exe │ ├── resources │ │ ├── Thumbs.db │ │ ├── oldreplace.wav │ │ ├── replace.wav │ │ ├── texter.ico │ │ └── texter48x48.png │ ├── texter.ahk │ └── texter.exe ├── 0.3 │ ├── Texter Installer 0.3.exe │ ├── TexterInstaller.ahk │ ├── texter.ahk │ └── texter.exe ├── 0.4 │ ├── Texter Installer 0.4.exe │ ├── TexterInstaller.ahk │ ├── texter.ahk │ └── texter.exe ├── 0.5 │ ├── Texter Installer 0.5.exe │ ├── TexterInstaller.ahk │ ├── texter.ahk │ └── texter.exe └── 0.6 │ ├── Texter Installer 0.6.exe │ ├── texter.ahk │ └── texter.exe ├── TODO.txt ├── TexterInstaller.ahk ├── export.ahk ├── import.ahk ├── includes ├── GUI │ ├── about_GUI.ahk │ ├── disablechecks.ahk │ ├── help_GUI.ahk │ ├── management_GUI.ahk │ ├── newkey_GUI.ahk │ ├── preferences_GUI.ahk │ ├── textprompt_GUI.ahk │ └── traymenu_GUI.ahk └── functions │ ├── InsSpecKeys.ahk │ ├── InstallAutocorrect.ahk │ ├── MonitorWindows.ahk │ ├── addtobank.ahk │ ├── autoclose.ahk │ ├── autocorrect.ahk │ ├── buildactive.ahk │ ├── bundles.ahk │ ├── delfrombank.ahk │ ├── disable.ahk │ ├── enabletriggers.ahk │ ├── getfilelist.ahk │ ├── getvalfromini.ahk │ ├── hexall.ahk │ ├── hexify.ahk │ ├── printablelist.ahk │ ├── renameHotstring.ahk │ ├── resources.ahk │ ├── savehotstring.ahk │ ├── updatecheck.ahk │ └── urls.ahk ├── printable.ahk ├── resources ├── Thumbs.db ├── autocorrect.txt ├── oldreplace.wav ├── replace.wav ├── style.css ├── texter.ico ├── texter.png ├── texter48x48.png └── throbber.gif ├── testers ├── 0.6a │ └── texter.exe ├── 0.6b │ └── texter.exe ├── 0.6c │ └── texter.exe └── 0.6d │ └── texter.exe └── texter.ahk /CurrentVersion.txt: -------------------------------------------------------------------------------- 1 | 0.6 2 | 20071106 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Texter 2 | ====== 3 | 4 | Text replacement/substitution application for Windows, written in AutoHotkey scripting language — inspired by OS X app TextExpander. 5 | 6 | For more details, see [this post](http://lifehacker.com/238306/lifehacker-code-texter-windows). 7 | -------------------------------------------------------------------------------- /Releases/0.1/TexterInstaller.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | Goto,DIRECTORY 4 | 5 | DIRECTORY: 6 | InstallDir = 7 | Gui, Add, Text,y10 x10,Where would you like to install Texter? 8 | Gui, Add, Edit, x20 y30 r1 W300 vInstallDir,%A_ProgramFiles%\Texter 9 | Gui, Add, Button,w80 GBrowse x320 y29,&Browse 10 | Gui, Add, Button,w80 default GInstall x225 yp+80,&Install 11 | Gui, Add, Button,w80 xp+90 GCancel,&Cancel 12 | Gui, Show, W400 H140,Install Texter 13 | RETURN 14 | 15 | BROWSE: 16 | FileSelectFolder, InstallDir,,1,Select your installation folder 17 | if ErrorLevel = 0 18 | GuiControl,,InstallDir,%InstallDir% 19 | RETURN 20 | 21 | INSTALL: 22 | Gui, Submit 23 | Gui,Destroy 24 | ;MsgBox,%InstallDir% 25 | IfNotExist,%InstallDir% 26 | FileCreateDir,%InstallDir% 27 | FileInstall,texter.exe,%InstallDir%\texter.exe,1 28 | if ErrorLevel = 0 29 | { 30 | ;MsgBox Problem! 31 | Gui, Add, Text,y10 x10,Texter successfully installed! 32 | Gui, Add, Checkbox, Checked y30 x20 vLaunch, Click here if you'd like to view the Texter install directory. 33 | Gui,Add,Text,y45 x45, Double-click texter.exe to launch Texter. 34 | Gui, Add, Button,w80 default GAutoRun x300 yp+65,&Finish 35 | Gui, Show, W400 H140,Installation complete 36 | } 37 | ;MsgBox, Installed 38 | 39 | return 40 | 41 | AUTORUN: 42 | Gui,Submit 43 | Gui,Destroy 44 | if Launch = 1 45 | Run,%InstallDir%\ 46 | Goto,Exit 47 | return 48 | 49 | CANCEL: 50 | Gui, Destroy 51 | Goto,Exit 52 | return 53 | 54 | EXIT: 55 | ExitApp -------------------------------------------------------------------------------- /Releases/0.1/TexterInstaller.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.1/TexterInstaller.exe -------------------------------------------------------------------------------- /Releases/0.1/resources/oldreplace.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.1/resources/oldreplace.wav -------------------------------------------------------------------------------- /Releases/0.1/resources/replace.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.1/resources/replace.wav -------------------------------------------------------------------------------- /Releases/0.1/resources/texter.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.1/resources/texter.ico -------------------------------------------------------------------------------- /Releases/0.1/resources/texter48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.1/resources/texter48x48.png -------------------------------------------------------------------------------- /Releases/0.1/texter.ahk: -------------------------------------------------------------------------------- 1 | ; Texter 2 | ; Author: Adam Pash 3 | ; Gratefully adapted several ideas from AutoClip by Skrommel: 4 | ; http://www.donationcoder.com/Software/Skrommel/index.html#AutoClip 5 | ; Script Function: 6 | ; Designed to implement simple, on-the-fly creation and managment 7 | ; of auto-replacing hotstrings for repetitive text 8 | ; http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php 9 | #SingleInstance,Force 10 | #NoEnv 11 | SetKeyDelay,0 12 | SetWinDelay,0 13 | SetWorkingDir, "%A_ScriptDir%" 14 | Gosub,READINI 15 | Gosub,RESOURCES 16 | Gosub,TRAYMENU 17 | 18 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 19 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 20 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 21 | Gosub,GetFileList 22 | Goto Start 23 | 24 | START: 25 | hotkey = 26 | Input,input,V L99,{SC77} 27 | if hotkey In %cancel% 28 | { 29 | Send,%hotkey% 30 | Goto,START 31 | } 32 | IfNotInString,FileList,%input%| 33 | { 34 | Send,%hotkey% 35 | Goto,START 36 | } 37 | else if hotkey = `{Space`} 38 | { 39 | if input in %SpaceKeys% 40 | { 41 | GoSub, Execute 42 | Goto,START 43 | } 44 | else 45 | { 46 | Send,%hotkey% 47 | Goto,Start 48 | } 49 | } 50 | else if hotkey = `{Enter`} 51 | { 52 | if input in %EnterKeys% 53 | { 54 | GoSub, Execute 55 | Goto,START 56 | } 57 | else 58 | { 59 | Send,%hotkey% 60 | Goto,Start 61 | } 62 | } 63 | else if hotkey = `{Tab`} 64 | { 65 | if input in %TabKeys% 66 | { 67 | GoSub, Execute 68 | GoTo,Start 69 | } 70 | else 71 | { 72 | Send,%hotkey% 73 | Goto,Start 74 | } 75 | } 76 | else 77 | { 78 | Send,%hotkey% 79 | Goto,START 80 | } 81 | return 82 | 83 | EXECUTE: 84 | SoundPlay, %A_ScriptDir%\resources\replace.wav 85 | oldClip = %Clipboard% 86 | ReturnTo := 0 87 | StringLen,BSlength,input 88 | Send {BS %BSlength%} 89 | FileRead, Clipboard, %A_WorkingDir%\replacements\%input%.txt 90 | IfInString,Clipboard,::scr:: 91 | { 92 | StringReplace,Script,Clipboard,::scr::,, 93 | Send,%Script% 94 | oldClip = %Clipboard% ; this is to make sure that if someone scripts a copy, it is retained 95 | return 96 | } 97 | else 98 | { 99 | IfInString,Clipboard,`%c 100 | { 101 | StringReplace, Clipboard, Clipboard, `%c, %oldClip%, All 102 | } 103 | IfInString,Clipboard,`%| 104 | { 105 | StringGetPos,CursorPoint,Clipboard,`%| 106 | StringReplace, MeasureClip,Clipboard,`n,,All 107 | StringGetPos,CursorPoint,MeasureClip,`%| 108 | StringReplace, Clipboard, Clipboard, `%|,, All 109 | StringReplace, MeasureClip,Clipboard,`n,,All 110 | StringLen,ClipLength,MeasureClip 111 | ReturnTo := ClipLength - CursorPoint 112 | } 113 | Send,^v 114 | if ReturnTo > 0 115 | Send {Left %ReturnTo%} 116 | Clipboard = %oldClip% 117 | } 118 | Return 119 | 120 | HOTKEYS: 121 | StringTrimLeft,hotkey,A_ThisHotkey,1 122 | StringLen,hotkeyl,hotkey 123 | If hotkeyl>1 124 | hotkey=`{%hotkey%`} 125 | Send,{SC77} 126 | Return 127 | 128 | READINI: 129 | IfNotExist bank 130 | FileCreateDir, bank 131 | IfNotExist replacements 132 | FileCreateDir, replacements 133 | IfNotExist resources 134 | FileCreateDir, resources 135 | IfNotExist,texter.ini 136 | FileAppend,[Hotkey]`nOntheFly=^+H`nManagement=`n[Autocomplete]`nKeys={Escape}`,{Tab}`,{Enter}`,{Space}`,{`,}`,{;}`,{.}`,{:}`,{Left}`,{Right}`n[Ignore]`nKeys={Tab}`,{Enter}`,{Space}`n[Cancel]`nKeys={Escape}`n,texter.ini 137 | IniRead,cancel,texter.ini,Cancel,Keys ;keys to stop completion, remember {} 138 | IniRead,ignore,texter.ini,Ignore,Keys ;keys not to send after completion 139 | IniRead,keys,texter.ini,Autocomplete,Keys 140 | IniRead,otfhotkey,texter.ini,Hotkey,OntheFly 141 | IniRead,managehotkey,texter.ini,Hotkey,Management 142 | ;MsgBox,%otfhotkey% 143 | Loop,Parse,keys,`, 144 | { 145 | StringTrimLeft,key,A_LoopField,1 146 | StringTrimRight,key,key,1 147 | StringLen,length,key 148 | If length=0 149 | Hotkey,$`,,HOTKEYS 150 | Else 151 | Hotkey,$%key%,HOTKEYS 152 | } 153 | if otfhotkey<> 154 | Hotkey,%otfhotkey%,NEWKEY 155 | if managehotkey <> 156 | Hotkey,%managehotkey%,MANAGE 157 | Return 158 | 159 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 160 | NEWKEY: 161 | Gui,1: Destroy 162 | Gui,1: font, s12, Arial 163 | Gui,1: +AlwaysOnTop -SysMenu +ToolWindow ;suppresses taskbar button, always on top, removes minimize/close 164 | Gui,1: Add, Text,x10 y20, Hotstring: 165 | Gui,1: Add, Edit, x13 y45 r1 W65 vRString, 166 | Gui,1: Add, Edit, x100 y45 r4 W395 vFullText, Enter your replacement text here... 167 | Gui,1: Add, Text,x115,Trigger: 168 | Gui,1: Add, Checkbox, vEnterCbox yp x175, Enter 169 | Gui,1: Add, Checkbox, vTabCbox yp x242, Tab 170 | Gui,1: Add, Checkbox, vSpaceCbox yp x305, Space 171 | Gui,1: font, s8, Arial 172 | Gui,1: Add, Button,w80 x320 default,&OK 173 | Gui,1: Add, Button,w80 xp+90 GButtonCancel,&Cancel 174 | Gui,1: font, s12, Arial 175 | Gui,1: Add,DropDownList,x100 y15 vTextOrScript, Text||Script 176 | Gui,1: Add,Picture,x20 y100,%A_WorkingDir%\resources\texter48x48.png 177 | Gui,1: Show, W500 H200,Add new hotstring... 178 | Hotkey,Esc,ButtonCancel,On 179 | return 180 | 181 | ButtonCancel: 182 | Gui,1: Destroy 183 | Hotkey,Esc,Off 184 | return 185 | 186 | ButtonOK: 187 | GuiControlGet,RString,,RString 188 | IfExist, %A_WorkingDir%\replacements\%RString%.txt 189 | { 190 | MsgBox,262144,Hotstring already exists, A replacement with the text %Rstring% already exists. Would you like to try again? 191 | return 192 | } 193 | GuiControlGet,EnterCbox,,EnterCbox 194 | GuiControlGet,TabCbox,,TabCbox 195 | GuiControlGet,SpaceCbox,,SpaceCbox 196 | if EnterCbox = 0 197 | if TabCbox = 0 198 | if SpaceCbox = 0 199 | { 200 | MsgBox,262144,Choose a trigger,You need to choose a trigger in order to save a hotstring replacement. 201 | return 202 | } 203 | Gui, Submit 204 | If RString<> 205 | { 206 | if FullText<> 207 | { 208 | if EnterCbox = 1 209 | { 210 | FileAppend,%Rstring%`,, %A_WorkingDir%\bank\enter.csv 211 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 212 | if TextOrScript = Script 213 | FullText = ::scr::%FullText% 214 | FileAppend,%FullText%,%A_WorkingDir%\replacements\%Rstring%.txt 215 | } 216 | if TabCbox = 1 217 | { 218 | FileAppend,%Rstring%`,, %A_WorkingDir%\bank\tab.csv 219 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 220 | IfNotExist, %A_WorkingDir%\replacements\%RString%.txt 221 | { 222 | if TextOrScript = Script 223 | FullText = ::scr::%FullText% 224 | FileAppend,%FullText%,%A_WorkingDir%\replacements\%Rstring%.txt 225 | } 226 | } 227 | if SpaceCbox = 1 228 | { 229 | FileAppend,%Rstring%`,, %A_WorkingDir%\bank\space.csv 230 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 231 | IfNotExist, %A_WorkingDir%\replacements\%RString%.txt 232 | { 233 | if TextOrScript = Script 234 | FullText = ::scr::%FullText% 235 | FileAppend,%FullText%,%A_WorkingDir%\replacements\%Rstring%.txt 236 | } 237 | } 238 | } 239 | } 240 | Gosub,GetFileList 241 | return 242 | 243 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 244 | 245 | 246 | 247 | TRAYMENU: 248 | Menu,TRAY,NoStandard 249 | Menu,TRAY,DeleteAll 250 | Menu,TRAY,Add,&Manage hotstrings,MANAGE 251 | Menu,TRAY,Add,&Create new hotstring,NEWKEY 252 | Menu,TRAY,Add 253 | Menu,TRAY,Add,&Preferences...,PREFERENCES 254 | Menu,TRAY,Add,&Help,HELP 255 | Menu,TRAY,Add 256 | Menu,TRAY,Add,&About...,ABOUT 257 | Menu,TRAY,Add,E&xit,EXIT 258 | Menu,Tray,Tip,Texter 259 | Return 260 | 261 | ABOUT: 262 | Gui,4: Destroy 263 | Gui,4: Add,Picture,x30 y10,%A_WorkingDir%\resources\texter48x48.png 264 | Gui,4: font, s36, Arial 265 | Gui,4: Add, Text,x90 y5,Texter 266 | Gui,4: font, s9, Arial 267 | Gui,4: Add,Text,x10 y70 Center,Texter is a text replacement utility designed to save`nyou countless keystrokes on repetitive text entry by`nreplacing user-defined abbreviations (or hotstrings)`nwith your frequently-used text snippets.`n`nTexter is written by Adam Pash and distributed`nby Lifehacker under the GNU Public License.`nFor details on how to use Texter, check out the 268 | Gui,4:Font,underline bold 269 | Gui,4:Add,Text,cBlue gTexterHomepage Center x110 y190,Texter homepage 270 | Gui,4: Show,w310 h220,About Texter 271 | Return 272 | 273 | TexterHomepage: 274 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php 275 | return 276 | 277 | BasicUse: 278 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#basic 279 | return 280 | 281 | Scripting: 282 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#advanced 283 | return 284 | 285 | HELP: 286 | Gui,5: Destroy 287 | Gui,5: Add,Picture,x65 y10,%A_WorkingDir%\resources\texter48x48.png 288 | Gui,5: font, s36, Arial 289 | Gui,5: Add, Text,x125 y5,Texter 290 | Gui,5: font, s9, Arial 291 | Gui,5: Add,Text,x19 y255 w300 center,All of Texter's documentation can be found online at the 292 | Gui,5:Font,underline bold 293 | Gui,5:Add,Text,cBlue gTexterHomepage Center x125 y275,Texter homepage 294 | Gui,5: font, s9 norm, Arial 295 | Gui,5: Add,Text,x10 y70 w300,For help by topic, click on one of the following: 296 | Gui,5:Font,underline bold 297 | Gui,5:Add,Text,x30 y90 cBlue gBasicUse,Basic Use: 298 | Gui,5:Font,norm 299 | Gui,5:Add,Text,x50 y110 w280, Covers how to create basic text replacement hotstrings. 300 | Gui,5:Font,underline bold 301 | Gui,5:Add,Text,x30 y150 cBlue gScripting,Sending advanced keystrokes: 302 | Gui,5:Font,norm 303 | Gui,5:Add,Text,x50 y170 w280, Texter is capable of sending advanced keystrokes, like keyboard combinations. This section lists all of the special characters used in script creation, and offers a few examples of how you might use scripts. 304 | Gui,5: Show,w350 h300,Texter Help 305 | Return 306 | 307 | GetFileList: 308 | FileList = 309 | Loop, %A_WorkingDir%\replacements\*.txt 310 | { 311 | FileList = %FileList%%A_LoopFileName%| 312 | } 313 | StringReplace, FileList, FileList, .txt,,All 314 | return 315 | 316 | PREFERENCES: 317 | if otfhotkey<> 318 | HotKey,%otfhotkey%,Off 319 | if managehotkey<> 320 | HotKey,%managehotkey%,Off 321 | Gui,3: Destroy 322 | Gui,3: Add,Text,x10 y10,On-the-Fly shortcut: 323 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsotfhotkey, %otfhotkey% 324 | Gui,3: Add,Text,x150 y10,Hotstring Management shortuct: 325 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsmanagehotkey, %managehotkey% 326 | Gui,3: Add,Button,x150 y95 w75 GSETTINGSOK Default,&OK 327 | Gui,3: Add,Button,x230 y95 w75 GSETTINGSCANCEL,&Cancel 328 | Gui,3: Show,w310 h120,Texter Preferences 329 | Return 330 | 331 | SETTINGSOK: 332 | Gui,3: Submit 333 | If sotfhotkey<> 334 | { 335 | otfhotkey:=sotfhotkey 336 | Hotkey,%otfhotkey%,Newkey 337 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 338 | HotKey,%otfhotkey%,On 339 | } 340 | else 341 | { 342 | otfhotkey:=sotfhotkey 343 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 344 | } 345 | If smanagehotkey<> 346 | { 347 | managehotkey:=smanagehotkey 348 | Hotkey,%managehotkey%,Manage 349 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 350 | HotKey,%managehotkey%,On 351 | } 352 | else 353 | { 354 | managehotkey:=smanagehotkey 355 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 356 | } 357 | Return 358 | 359 | SETTINGSCANCEL: 360 | Gui,3:Destroy 361 | if otfhotkey<> 362 | HotKey,%otfhotkey%,On 363 | if managehotkey <> 364 | HotKey,%managehotkey%,On 365 | Return 366 | 367 | MANAGE: 368 | GoSub,GetFileList 369 | StringReplace, FileList, FileList, .txt,,All 370 | Gui,2: Destroy 371 | Gui,2: font, s12, Arial 372 | Gui,2: Add, Text,x15 y20, Hotstring: 373 | Gui,2: Add, ListBox, x13 y40 r15 W100 vChoice gShowString Sort,%FileList% 374 | Gui,2: Add,DropDownList,x+20 y15 vTextOrScript, Text||Script 375 | Gui,2: Add, Edit, xp y45 r12 W460 vFullText, 376 | Gui,2: Add, Text,y282 x150,Trigger: 377 | Gui,2: Add, Checkbox, vEnterCbox yp xp+60, Enter 378 | Gui,2: Add, Checkbox, vTabCbox yp xp+65, Tab 379 | Gui,2: Add, Checkbox, vSpaceCbox yp xp+60, Space 380 | Gui,2: font, s8, Arial 381 | Gui,2: Add,Button,w80 GPButtonSave yp x500,&Save 382 | Gui,2: Add, Button,w80 default GPButtonOK x420 yp+80,&OK 383 | Gui,2: Add, Button,w80 xp+90 GPButtonCancel,&Cancel 384 | Gui,2: font, s12, Arial 385 | Gui,2: Add, Button, w35 x20 y320 GAdd,+ 386 | Gui,2: Add, Button, w35 x60 y320 GDelete,- 387 | Gui,2: Show, W600 H400, Texter Management 388 | return 389 | 390 | ADD: 391 | Loop,Parse,keys,`, 392 | { 393 | StringTrimLeft,key,A_LoopField,1 394 | StringTrimRight,key,key,1 395 | StringLen,length,key 396 | If length=0 397 | Hotkey,$`,,Off 398 | Else 399 | Hotkey,$%key%,Off 400 | } 401 | GoSub,Newkey 402 | IfWinExist,Add new hotstring... 403 | { 404 | WinWaitClose,Add new hotstring...,, 405 | } 406 | GoSub,GetFileList 407 | StringReplace, FileList, FileList,|%RString%|,|%RString%|| 408 | GuiControl,,Choice,|%FileList% 409 | GoSub,ShowString 410 | Loop,Parse,keys,`, 411 | { 412 | StringTrimLeft,key,A_LoopField,1 413 | StringTrimRight,key,key,1 414 | StringLen,length,key 415 | If length=0 416 | Hotkey,$`,,On 417 | Else 418 | Hotkey,$%key%,On 419 | } 420 | return 421 | 422 | DELETE: 423 | GuiControlGet,ActiveChoice,,Choice 424 | MsgBox,1,Confirm Delete,Are you sure you want to delete this hotstring: %ActiveChoice% 425 | IfMsgBox, OK 426 | { 427 | FileDelete,%A_WorkingDir%\replacements\%ActiveChoice%.txt 428 | if ActiveChoice in %EnterKeys% 429 | { 430 | StringReplace, EnterKeys, EnterKeys, %ActiveChoice%`,,,All 431 | FileDelete, %A_WorkingDir%\bank\enter.csv 432 | FileAppend,%EnterKeys%, %A_WorkingDir%\bank\enter.csv 433 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 434 | } 435 | if ActiveChoice in %TabKeys% 436 | { 437 | StringReplace, TabKeys, TabKeys, %ActiveChoice%`,,,All 438 | FileDelete, %A_WorkingDir%\bank\tab.csv 439 | FileAppend,%TabKeys%, %A_WorkingDir%\bank\tab.csv 440 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 441 | } 442 | if ActiveChoice in %SpaceKeys% 443 | { 444 | StringReplace, SpaceKeys, SpaceKeys, %ActiveChoice%`,,,All 445 | FileDelete, %A_WorkingDir%\bank\space.csv 446 | FileAppend,%SpaceKeys%, %A_WorkingDir%\bank\space.csv 447 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 448 | } 449 | GoSub,GetFileList 450 | GuiControl,,Choice,|%FileList% 451 | GuiControl,,FullText, 452 | GuiControl,,EnterCbox,0 453 | GuiControl,,TabCbox,0 454 | GuiControl,,SpaceCbox,0 455 | } 456 | else 457 | return 458 | return 459 | 460 | ShowString: 461 | GuiControlGet,ActiveChoice,,Choice 462 | if ActiveChoice in %EnterKeys% 463 | { 464 | GuiControl,,EnterCbox,1 465 | } 466 | else 467 | GuiControl,,EnterCbox,0 468 | if ActiveChoice in %TabKeys% 469 | { 470 | GuiControl,,TabCbox,1 471 | } 472 | else 473 | GuiControl,,TabCbox,0 474 | if ActiveChoice in %SpaceKeys% 475 | { 476 | GuiControl,,SpaceCbox,1 477 | } 478 | else 479 | GuiControl,,SpaceCbox,0 480 | 481 | FileRead, Text, %A_WorkingDir%\replacements\%ActiveChoice%.txt 482 | IfInString,Text,::scr:: 483 | { 484 | GuiControl,,TextOrScript,|Text|Script|| 485 | StringReplace,Text,Text,::scr::,, 486 | } 487 | else 488 | GuiControl,,TextOrScript,|Text||Script 489 | GuiControl,,FullText,%Text% 490 | return 491 | 492 | PButtonSave: 493 | GuiControlGet,ActiveChoice,,Choice 494 | GuiControlGet,SaveText,,FullText 495 | GuiControlGet,ToS,,TextOrScript 496 | FileDelete, %A_WorkingDir%\replacements\%ActiveChoice%.txt 497 | if ToS = Text 498 | { 499 | FileAppend,%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 500 | } 501 | else 502 | { 503 | FileAppend,::scr::%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 504 | } 505 | GuiControlGet,ActiveChoice,,Choice 506 | GuiControlGet,EnterCbox,,EnterCbox 507 | GuiControlGet,TabCbox,,TabCbox 508 | GuiControlGet,SpaceCbox,,SpaceCbox 509 | Gosub,SAVE 510 | ;; 511 | return 512 | 513 | PButtonCancel: 514 | Gui, Destroy 515 | return 516 | 517 | PButtonOK: 518 | Gui, Submit 519 | GuiControlGet,ActiveChoice,,Choice 520 | GuiControlGet,SaveText,,FullText 521 | GuiControlGet,ToS,,TextOrScript 522 | FileDelete, %A_WorkingDir%\replacements\%ActiveChoice%.txt 523 | if ToS = Text 524 | FileAppend,%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 525 | else 526 | FileAppend,::scr::%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 527 | 528 | GuiControlGet,ActiveChoice,,Choice 529 | GuiControlGet,EnterCbox,,EnterCbox 530 | GuiControlGet,TabCbox,,TabCbox 531 | GuiControlGet,SpaceCbox,,SpaceCbox 532 | Gosub,SAVE 533 | 534 | return 535 | 536 | SAVE: 537 | if EnterCbox = 1 538 | { 539 | if ActiveChoice in %EnterKeys% 540 | { 541 | } 542 | else 543 | { 544 | FileAppend,%ActiveChoice%`,, %A_WorkingDir%\bank\enter.csv 545 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 546 | } 547 | } 548 | else 549 | { 550 | if ActiveChoice in %EnterKeys% 551 | { 552 | StringReplace, EnterKeys, EnterKeys, %ActiveChoice%`,,,All 553 | FileDelete, %A_WorkingDir%\bank\enter.csv 554 | FileAppend,%EnterKeys%, %A_WorkingDir%\bank\enter.csv 555 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 556 | } 557 | } 558 | if TabCbox = 1 559 | { 560 | if ActiveChoice in %TabKeys% 561 | { 562 | } 563 | else 564 | { 565 | FileAppend,%ActiveChoice%`,, %A_WorkingDir%\bank\tab.csv 566 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 567 | } 568 | } 569 | else 570 | { 571 | if ActiveChoice in %TabKeys% 572 | { 573 | StringReplace, TabKeys, TabKeys, %ActiveChoice%`,,,All 574 | FileDelete, %A_WorkingDir%\bank\tab.csv 575 | FileAppend,%TabKeys%, %A_WorkingDir%\bank\tab.csv 576 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 577 | } 578 | 579 | } 580 | if SpaceCbox = 1 581 | { 582 | if ActiveChoice in %SpaceKeys% 583 | { 584 | } 585 | else 586 | { 587 | FileAppend,%ActiveChoice%`,, %A_WorkingDir%\bank\space.csv 588 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 589 | } 590 | } 591 | else 592 | { 593 | if ActiveChoice in %SpaceKeys% 594 | { 595 | StringReplace, SpaceKeys, SpaceKeys, %ActiveChoice%`,,,All 596 | FileDelete, %A_WorkingDir%\bank\space.csv 597 | FileAppend,%SpaceKeys%, %A_WorkingDir%\bank\space.csv 598 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 599 | } 600 | 601 | } 602 | return 603 | 604 | RESOURCES: 605 | IfNotExist,%A_ScriptDir%\resources\texter.ico 606 | FileInstall,texter.ico,%A_ScriptDir%\resources\texter.ico,1 607 | IfNotExist,%A_ScriptDir%\resources\replace.wav 608 | FileInstall,replace.wav,%A_ScriptDir%\resources\replace.wav,1 609 | IfNotExist,%A_ScriptDir%\resources\texter48x48.png 610 | FileInstall,texter48x48.png,%A_ScriptDir%\resources\texter48x48.png,1 611 | return 612 | 613 | EXIT: 614 | ExitApp -------------------------------------------------------------------------------- /Releases/0.1/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.1/texter.exe -------------------------------------------------------------------------------- /Releases/0.2/TexterInstaller.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | #NoTrayIcon 4 | Goto,DIRECTORY 5 | 6 | DIRECTORY: 7 | InstallDir = 8 | Gui, Add, Text,y10 x10,Where would you like to install Texter? 9 | Gui, Add, Edit, x20 y30 r1 W300 vInstallDir,%A_ProgramFiles%\Texter 10 | Gui, Add, Button,w80 GBrowse x320 y29,&Browse 11 | Gui, Add, Text, y60 x30,Note: If Texter is currently running, close the program before continuing. 12 | Gui, Add, Button,w80 default GInstall x225 yp+50,&Install 13 | Gui, Add, Button,w80 xp+90 GCancel,&Cancel 14 | Gui, Show, W400 H140,Install Texter 15 | RETURN 16 | 17 | BROWSE: 18 | FileSelectFolder, InstallDir,,1,Select your installation folder 19 | if ErrorLevel = 0 20 | GuiControl,,InstallDir,%InstallDir% 21 | RETURN 22 | 23 | INSTALL: 24 | Gui, Submit 25 | Gui,Destroy 26 | ;MsgBox,%InstallDir% 27 | IfNotExist,%InstallDir% 28 | FileCreateDir,%InstallDir% 29 | FileInstall,texter.exe,%InstallDir%\texter.exe,1 30 | if ErrorLevel = 0 31 | { 32 | ;MsgBox Problem! 33 | Gui, Add, Text,y10 x10,Texter successfully installed! 34 | Gui, Add, Checkbox, Checked y30 x20 vLaunch, Click here if you'd like to view the Texter install directory. 35 | Gui,Add,Text,y45 x45, Double-click texter.exe to launch Texter. 36 | Gui, Add, Button,w80 default GAutoRun x300 yp+65,&Finish 37 | Gui, Show, W400 H140,Installation complete 38 | } 39 | ;MsgBox, Installed 40 | 41 | return 42 | 43 | AUTORUN: 44 | Gui,Submit 45 | Gui,Destroy 46 | if Launch = 1 47 | Run,%InstallDir%\ 48 | Goto,Exit 49 | return 50 | 51 | CANCEL: 52 | Gui, Destroy 53 | Goto,Exit 54 | return 55 | 56 | EXIT: 57 | ExitApp -------------------------------------------------------------------------------- /Releases/0.2/TexterInstaller.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/TexterInstaller.exe -------------------------------------------------------------------------------- /Releases/0.2/resources/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/resources/Thumbs.db -------------------------------------------------------------------------------- /Releases/0.2/resources/oldreplace.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/resources/oldreplace.wav -------------------------------------------------------------------------------- /Releases/0.2/resources/replace.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/resources/replace.wav -------------------------------------------------------------------------------- /Releases/0.2/resources/texter.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/resources/texter.ico -------------------------------------------------------------------------------- /Releases/0.2/resources/texter48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/resources/texter48x48.png -------------------------------------------------------------------------------- /Releases/0.2/texter.ahk: -------------------------------------------------------------------------------- 1 | ; Texter 2 | ; Author: Adam Pash 3 | ; Gratefully adapted several ideas from AutoClip by Skrommel: 4 | ; http://www.donationcoder.com/Software/Skrommel/index.html#AutoClip 5 | ; Huge thanks to Dustin Luck for his contributions 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 10 | #SingleInstance,Force 11 | #NoEnv 12 | AutoTrim,off 13 | SetKeyDelay,0 14 | SetWinDelay,0 15 | SetWorkingDir, "%A_ScriptDir%" 16 | Gosub,READINI 17 | Gosub,RESOURCES 18 | Gosub,TRAYMENU 19 | ;Gosub,AUTOCLOSE 20 | 21 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 22 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 23 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 24 | Gosub,GetFileList 25 | Goto Start 26 | 27 | START: 28 | hotkey = 29 | Input,input,V L99,{SC77} 30 | if hotkey In %cancel% 31 | { 32 | Send,%hotkey% 33 | Goto,START 34 | } 35 | IfNotInString,FileList,%input%| 36 | { 37 | Send,%hotkey% 38 | Goto,START 39 | } 40 | else if hotkey = `{Space`} 41 | { 42 | if input in %SpaceKeys% 43 | { 44 | GoSub, Execute 45 | Goto,START 46 | } 47 | else 48 | { 49 | Send,%hotkey% 50 | Goto,Start 51 | } 52 | } 53 | else if hotkey = `{Enter`} 54 | { 55 | if input in %EnterKeys% 56 | { 57 | GoSub, Execute 58 | Goto,START 59 | } 60 | else 61 | { 62 | Send,%hotkey% 63 | Goto,Start 64 | } 65 | } 66 | else if hotkey = `{Tab`} 67 | { 68 | if input in %TabKeys% 69 | { 70 | GoSub, Execute 71 | GoTo,Start 72 | } 73 | else 74 | { 75 | Send,%hotkey% 76 | Goto,Start 77 | } 78 | } 79 | else 80 | { 81 | Send,%hotkey% 82 | Goto,START 83 | } 84 | return 85 | 86 | EXECUTE: 87 | SoundPlay, %A_ScriptDir%\resources\replace.wav 88 | ReturnTo := 0 89 | StringLen,BSlength,input 90 | Send {BS %BSlength%} 91 | FileRead, ReplacementText, %A_WorkingDir%\replacements\%input%.txt 92 | 93 | IfInString,ReplacementText,::scr:: 94 | { 95 | ;To fix double spacing issue, replace `r`n (return + new line) as AHK sends a new line for each character 96 | StringReplace,ReplacementText,ReplacementText,`r`n,`n, All 97 | StringReplace,Script,ReplacementText,::scr::,, 98 | Send,%Script% 99 | return 100 | } 101 | else 102 | { 103 | ;To fix double spacing issue, replace `r`n (return + new line) as AHK sends a new line for each character 104 | ;(but only in compatibility mode) 105 | if MODE = 0 106 | { 107 | StringReplace,ReplacementText,ReplacementText,`r`n,`n, All 108 | } 109 | IfInString,ReplacementText,`%c 110 | { 111 | StringReplace, ReplacementText, ReplacementText, `%c, %Clipboard%, All 112 | } 113 | IfInString,ReplacementText,`%t 114 | { 115 | FormatTime, CurrTime, , Time 116 | StringReplace, ReplacementText, ReplacementText, `%t, %CurrTime%, All 117 | } 118 | IfInString,ReplacementText,`%ds 119 | { 120 | FormatTime, SDate, , ShortDate 121 | StringReplace, ReplacementText, ReplacementText, `%ds, %SDate%, All 122 | } 123 | IfInString,ReplacementText,`%dl 124 | { 125 | FormatTime, LDate, , LongDate 126 | StringReplace, ReplacementText, ReplacementText, `%dl, %LDate%, All 127 | } 128 | IfInString,ReplacementText,`%| 129 | { 130 | ;in clipboard mode, CursorPoint & ClipLength need to be calculated after replacing `r`n 131 | if MODE = 0 132 | { 133 | MeasurementText := ReplacementText 134 | } 135 | else 136 | { 137 | StringReplace,MeasurementText,ReplacementText,`r`n,`n, All 138 | } 139 | StringGetPos,CursorPoint,MeasurementText,`%| 140 | StringReplace, ReplacementText, ReplacementText, `%|,, All 141 | StringReplace, MeasurementText, MeasurementText, `%|,, All 142 | StringLen,ClipLength,MeasurementText 143 | ReturnTo := ClipLength - CursorPoint 144 | } 145 | 146 | if MODE = 0 147 | SendRaw,%ReplacementText% 148 | else 149 | { 150 | oldClip = %Clipboard% 151 | Clipboard = %ReplacementText% 152 | Send,^v 153 | Clipboard = %oldClip% 154 | } 155 | if ReturnTo > 0 156 | Send {Left %ReturnTo%} 157 | } 158 | Return 159 | 160 | HOTKEYS: 161 | StringTrimLeft,hotkey,A_ThisHotkey,1 162 | StringLen,hotkeyl,hotkey 163 | If hotkeyl>1 164 | hotkey=`{%hotkey%`} 165 | Send,{SC77} 166 | Return 167 | 168 | READINI: 169 | IfNotExist bank 170 | FileCreateDir, bank 171 | IfNotExist replacements 172 | FileCreateDir, replacements 173 | IfNotExist resources 174 | FileCreateDir, resources 175 | cancel := GetValFromIni("Cancel","Keys","{Escape}") ;keys to stop completion, remember {} 176 | ignore := GetValFromIni("Ignore","Keys","{Tab}`,{Enter}`,{Space}") ;keys not to send after completion 177 | keys := GetValFromIni("Autocomplete","Keys","{Escape}`,{Tab}`,{Enter}`,{Space}`,{Left}`,{Right}") 178 | otfhotkey := GetValFromIni("Hotkey","OntheFly","^+H") 179 | managehotkey := GetValFromIni("Hotkey","Management","") 180 | MODE := GetValFromIni("Settings","Mode",0) 181 | EnterBox := GetValFromIni("Triggers","Enter",0) 182 | TabBox := GetValFromIni("Triggers","Tab",0) 183 | SpaceBox := GetValFromIni("Triggers","Space",0) 184 | 185 | Loop,Parse,keys,`, 186 | { 187 | StringTrimLeft,key,A_LoopField,1 188 | StringTrimRight,key,key,1 189 | StringLen,length,key 190 | If length=0 191 | Hotkey,$`,,HOTKEYS 192 | Else 193 | Hotkey,$%key%,HOTKEYS 194 | } 195 | if otfhotkey<> 196 | Hotkey,%otfhotkey%,NEWKEY 197 | if managehotkey <> 198 | Hotkey,%managehotkey%,MANAGE 199 | Return 200 | 201 | GetValFromIni(section, key, default) 202 | { 203 | IniRead,IniVal,texter.ini,%section%,%key% 204 | if IniVal = ERROR 205 | { 206 | IniWrite,%default%,texter.ini,%section%,%key% 207 | IniVal := default 208 | } 209 | return IniVal 210 | } 211 | 212 | 213 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 214 | NEWKEY: 215 | Gui,1: Destroy 216 | Gui,1: font, s12, Arial 217 | Gui,1: +AlwaysOnTop -SysMenu +ToolWindow ;suppresses taskbar button, always on top, removes minimize/close 218 | Gui,1: Add, Text,x10 y20, Hotstring: 219 | Gui,1: Add, Edit, x13 y45 r1 W65 vRString, 220 | Gui,1: Add, Edit, x100 y45 r4 W395 vFullText, Enter your replacement text here... 221 | Gui,1: Add, Text,x115,Trigger: 222 | Gui,1: Add, Checkbox, vEnterCbox yp x175 Checked%EnterBox%, Enter 223 | Gui,1: Add, Checkbox, vTabCbox yp x242 Checked%TabBox%, Tab 224 | Gui,1: Add, Checkbox, vSpaceCbox yp x305 Checked%SpaceBox%, Space 225 | Gui,1: font, s8, Arial 226 | Gui,1: Add, Button,w80 x320 default,&OK 227 | Gui,1: Add, Button,w80 xp+90 GButtonCancel,&Cancel 228 | Gui,1: font, s12, Arial 229 | Gui,1: Add,DropDownList,x100 y15 vTextOrScript, Text||Script 230 | Gui,1: Add,Picture,x20 y100,%A_WorkingDir%\resources\texter48x48.png 231 | Gui,1: Show, W500 H200,Add new hotstring... 232 | Hotkey,IfWinActive, Add new hotstring 233 | Hotkey,Esc,ButtonCancel,On 234 | Hotkey,IfWinActive 235 | return 236 | 237 | ButtonCancel: 238 | Gui,1: Destroy 239 | return 240 | 241 | ButtonOK: 242 | GuiControlGet,RString,,RString 243 | IfExist, %A_WorkingDir%\replacements\%RString%.txt 244 | { 245 | MsgBox,262144,Hotstring already exists, A replacement with the text %Rstring% already exists. Would you like to try again? 246 | return 247 | } 248 | GuiControlGet,EnterCbox,,EnterCbox 249 | GuiControlGet,TabCbox,,TabCbox 250 | GuiControlGet,SpaceCbox,,SpaceCbox 251 | if EnterCbox = 0 252 | if TabCbox = 0 253 | if SpaceCbox = 0 254 | { 255 | MsgBox,262144,Choose a trigger,You need to choose a trigger in order to save a hotstring replacement. 256 | return 257 | } 258 | Gui, Submit 259 | If RString<> 260 | { 261 | if FullText<> 262 | { 263 | if EnterCbox = 1 264 | { 265 | IniWrite,1,texter.ini,Triggers,Enter 266 | FileAppend,%Rstring%`,, %A_WorkingDir%\bank\enter.csv 267 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 268 | if TextOrScript = Script 269 | FullText = ::scr::%FullText% 270 | FileAppend,%FullText%,%A_WorkingDir%\replacements\%Rstring%.txt 271 | } 272 | else 273 | IniWrite,0,texter.ini,Triggers,Enter 274 | if TabCbox = 1 275 | { 276 | IniWrite,1,texter.ini,Triggers,Tab 277 | FileAppend,%Rstring%`,, %A_WorkingDir%\bank\tab.csv 278 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 279 | IfNotExist, %A_WorkingDir%\replacements\%RString%.txt 280 | { 281 | if TextOrScript = Script 282 | FullText = ::scr::%FullText% 283 | FileAppend,%FullText%,%A_WorkingDir%\replacements\%Rstring%.txt 284 | } 285 | } 286 | else 287 | IniWrite,0,texter.ini,Triggers,Tab 288 | if SpaceCbox = 1 289 | { 290 | IniWrite,1,texter.ini,Triggers,Space 291 | FileAppend,%Rstring%`,, %A_WorkingDir%\bank\space.csv 292 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 293 | IfNotExist, %A_WorkingDir%\replacements\%RString%.txt 294 | { 295 | if TextOrScript = Script 296 | FullText = ::scr::%FullText% 297 | FileAppend,%FullText%,%A_WorkingDir%\replacements\%Rstring%.txt 298 | } 299 | } 300 | else 301 | IniWrite,0,texter.ini,Triggers,Space 302 | } 303 | } 304 | IniRead,EnterBox,texter.ini,Triggers,Enter 305 | IniRead,TabBox,texter.ini,Triggers,Tab 306 | IniRead,SpaceBox,texter.ini,Triggers,Space 307 | Gosub,GetFileList 308 | return 309 | 310 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 311 | 312 | 313 | 314 | TRAYMENU: 315 | Menu,TRAY,NoStandard 316 | Menu,TRAY,DeleteAll 317 | Menu,TRAY,Add,&Manage hotstrings,MANAGE 318 | Menu,TRAY,Add,&Create new hotstring,NEWKEY 319 | Menu,TRAY,Add 320 | Menu,TRAY,Add,&Preferences...,PREFERENCES 321 | Menu,TRAY,Add,&Help,HELP 322 | Menu,TRAY,Add 323 | Menu,TRAY,Add,&About...,ABOUT 324 | Menu,TRAY,Add,E&xit,EXIT 325 | Menu,TRAY,Default,&Manage hotstrings 326 | Menu,Tray,Tip,Texter 327 | Return 328 | 329 | ABOUT: 330 | Gui,4: Destroy 331 | Gui,4: Add,Picture,x30 y10,%A_WorkingDir%\resources\texter48x48.png 332 | Gui,4: font, s36, Arial 333 | Gui,4: Add, Text,x90 y5,Texter 334 | Gui,4: font, s9, Arial 335 | Gui,4: Add,Text,x10 y70 Center,Texter is a text replacement utility designed to save`nyou countless keystrokes on repetitive text entry by`nreplacing user-defined abbreviations (or hotstrings)`nwith your frequently-used text snippets.`n`nTexter is written by Adam Pash and distributed`nby Lifehacker under the GNU Public License.`nFor details on how to use Texter, check out the 336 | Gui,4:Font,underline bold 337 | Gui,4:Add,Text,cBlue gTexterHomepage Center x110 y190,Texter homepage 338 | Gui,4: Show,w310 h220,About Texter 339 | Hotkey,IfWinActive, About Texter 340 | Hotkey,Esc,DismissAbout,On 341 | Hotkey,IfWinActive 342 | Return 343 | 344 | TexterHomepage: 345 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php 346 | return 347 | 348 | BasicUse: 349 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#basic 350 | return 351 | 352 | Scripting: 353 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#advanced 354 | return 355 | 356 | DismissAbout: 357 | Gui,4: Destroy 358 | return 359 | 360 | HELP: 361 | Gui,5: Destroy 362 | Gui,5: Add,Picture,x65 y10,%A_WorkingDir%\resources\texter48x48.png 363 | Gui,5: font, s36, Arial 364 | Gui,5: Add, Text,x125 y5,Texter 365 | Gui,5: font, s9, Arial 366 | Gui,5: Add,Text,x19 y255 w300 center,All of Texter's documentation can be found online at the 367 | Gui,5:Font,underline bold 368 | Gui,5:Add,Text,cBlue gTexterHomepage Center x125 y275,Texter homepage 369 | Gui,5: font, s9 norm, Arial 370 | Gui,5: Add,Text,x10 y70 w300,For help by topic, click on one of the following: 371 | Gui,5:Font,underline bold 372 | Gui,5:Add,Text,x30 y90 cBlue gBasicUse,Basic Use: 373 | Gui,5:Font,norm 374 | Gui,5:Add,Text,x50 y110 w280, Covers how to create basic text replacement hotstrings. 375 | Gui,5:Font,underline bold 376 | Gui,5:Add,Text,x30 y150 cBlue gScripting,Sending advanced keystrokes: 377 | Gui,5:Font,norm 378 | Gui,5:Add,Text,x50 y170 w280, Texter is capable of sending advanced keystrokes, like keyboard combinations. This section lists all of the special characters used in script creation, and offers a few examples of how you might use scripts. 379 | Gui,5: Show,w350 h300,Texter Help 380 | Hotkey,IfWinActive, Texter Help 381 | Hotkey,Esc,DismissHelp,On 382 | Hotkey,IfWinActive 383 | Return 384 | 385 | DismissHelp: 386 | Gui,5: Destroy 387 | return 388 | 389 | GetFileList: 390 | FileList = 391 | Loop, %A_WorkingDir%\replacements\*.txt 392 | { 393 | FileList = %FileList%%A_LoopFileName%| 394 | } 395 | StringReplace, FileList, FileList, .txt,,All 396 | return 397 | 398 | PREFERENCES: 399 | if otfhotkey<> 400 | HotKey,%otfhotkey%,Off 401 | if managehotkey<> 402 | HotKey,%managehotkey%,Off 403 | Gui,3: Destroy 404 | Gui,3: Add,Text,x10 y10,On-the-Fly shortcut: 405 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsotfhotkey, %otfhotkey% 406 | Gui,3: Add,Text,x150 y10,Hotstring Management shortcut: 407 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsmanagehotkey, %managehotkey% 408 | ;code optimization -- use mode value to set in initial radio values 409 | CompatMode := NOT MODE 410 | Gui,3: Add,Radio,x10 y70 vModeGroup Checked%CompatMode%,Compatibility mode (Default) 411 | Gui,3: Add,Radio,Checked%MODE%,Clipboard mode (Faster, but less compatible) 412 | IniRead,OnStartup,texter.ini,Settings,Startup 413 | Gui,3: Add,Checkbox, vStartup x20 yp+30 Checked%OnStartup%,Run Texter at start up 414 | Gui,3: Add,Button,x150 y145 w75 GSETTINGSOK Default,&OK 415 | Gui,3: Add,Button,x230 y145 w75 GSETTINGSCANCEL,&Cancel 416 | Gui,3: Show,w310 h170,Texter Preferences 417 | Hotkey,IfWinActive, Texter Preferences 418 | Hotkey,Esc,SETTINGSCANCEL,On 419 | Hotkey,IfWinActive 420 | Return 421 | 422 | SETTINGSOK: 423 | Gui,3: Submit 424 | If sotfhotkey<> 425 | { 426 | otfhotkey:=sotfhotkey 427 | Hotkey,%otfhotkey%,Newkey 428 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 429 | HotKey,%otfhotkey%,On 430 | } 431 | else 432 | { 433 | otfhotkey:=sotfhotkey 434 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 435 | } 436 | If smanagehotkey<> 437 | { 438 | managehotkey:=smanagehotkey 439 | Hotkey,%managehotkey%,Manage 440 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 441 | HotKey,%managehotkey%,On 442 | } 443 | else 444 | { 445 | managehotkey:=smanagehotkey 446 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 447 | } 448 | ;code optimization -- calculate MODE from ModeGroup 449 | MODE := ModeGroup - 1 450 | IniWrite,%MODE%,texter.ini,Settings,Mode 451 | If Startup = 1 452 | { 453 | IfNotExist %A_StartMenu%\Programs\Startup\Texter.lnk 454 | ;Get icon for shortcut link: 455 | ;1st from compiled EXE 456 | if %A_IsCompiled% 457 | { 458 | IconLocation=%A_ScriptFullPath% 459 | } 460 | ;2nd from icon in resources folder 461 | else IfExist %A_WorkingDir%\resources\texter.ico 462 | { 463 | IconLocation=%A_WorkingDir%\resources\texter.ico 464 | } 465 | ;3rd from the AutoHotkey application itself 466 | else 467 | { 468 | IconLocation=%A_AhkPath% 469 | } 470 | ;use %A_ScriptFullPath% instead of %A_WorkingDir%\texter.exe 471 | ;to allow compatibility with source version 472 | FileCreateShortcut,%A_ScriptFullPath%,%A_StartMenu%\Programs\Startup\Texter.lnk,%A_WorkingDir%,,Text replacement system tray application,%IconLocation% 473 | } 474 | else 475 | { 476 | IfExist %A_StartMenu%\Programs\Startup\Texter.lnk 477 | { 478 | FileDelete %A_StartMenu%\Programs\Startup\Texter.lnk 479 | } 480 | } 481 | IniWrite,%Startup%,texter.ini,Settings,Startup 482 | 483 | Return 484 | 485 | SETTINGSCANCEL: 486 | Gui,3:Destroy 487 | if otfhotkey<> 488 | HotKey,%otfhotkey%,On 489 | if managehotkey <> 490 | HotKey,%managehotkey%,On 491 | Return 492 | 493 | MANAGE: 494 | GoSub,GetFileList 495 | StringReplace, FileList, FileList, .txt,,All 496 | Gui,2: Destroy 497 | Gui,2: font, s12, Arial 498 | Gui,2: Add, Text,x15 y20, Hotstring: 499 | Gui,2: Add, ListBox, x13 y40 r15 W100 vChoice gShowString Sort,%FileList% 500 | Gui,2: Add,DropDownList,x+20 y15 vTextOrScript, Text||Script 501 | Gui,2: Add, Edit, xp y45 r12 W460 vFullText, 502 | Gui,2: Add, Text,y282 x150,Trigger: 503 | Gui,2: Add, Checkbox, vEnterCbox yp xp+60, Enter 504 | Gui,2: Add, Checkbox, vTabCbox yp xp+65, Tab 505 | Gui,2: Add, Checkbox, vSpaceCbox yp xp+60, Space 506 | Gui,2: font, s8, Arial 507 | Gui,2: Add,Button,w80 GPButtonSave yp x500,&Save 508 | Gui,2: Add, Button,w80 default GPButtonOK x420 yp+80,&OK 509 | Gui,2: Add, Button,w80 xp+90 GPButtonCancel,&Cancel 510 | Gui,2: font, s12, Arial 511 | Gui,2: Add, Button, w35 x20 y320 GAdd,+ 512 | Gui,2: Add, Button, w35 x60 y320 GDelete,- 513 | Gui,2: Show, W600 H400, Texter Management 514 | Hotkey,IfWinActive, Texter Management 515 | Hotkey,Esc,PButtonCancel,On 516 | Hotkey,IfWinActive 517 | return 518 | 519 | ADD: 520 | Loop,Parse,keys,`, 521 | { 522 | StringTrimLeft,key,A_LoopField,1 523 | StringTrimRight,key,key,1 524 | StringLen,length,key 525 | If length=0 526 | Hotkey,$`,,Off 527 | Else 528 | Hotkey,$%key%,Off 529 | } 530 | GoSub,Newkey 531 | IfWinExist,Add new hotstring... 532 | { 533 | WinWaitClose,Add new hotstring...,, 534 | } 535 | GoSub,GetFileList 536 | StringReplace, FileList, FileList,|%RString%|,|%RString%|| 537 | GuiControl,,Choice,|%FileList% 538 | GoSub,ShowString 539 | Loop,Parse,keys,`, 540 | { 541 | StringTrimLeft,key,A_LoopField,1 542 | StringTrimRight,key,key,1 543 | StringLen,length,key 544 | If length=0 545 | Hotkey,$`,,On 546 | Else 547 | Hotkey,$%key%,On 548 | } 549 | return 550 | 551 | DELETE: 552 | GuiControlGet,ActiveChoice,,Choice 553 | MsgBox,1,Confirm Delete,Are you sure you want to delete this hotstring: %ActiveChoice% 554 | IfMsgBox, OK 555 | { 556 | FileDelete,%A_WorkingDir%\replacements\%ActiveChoice%.txt 557 | if ActiveChoice in %EnterKeys% 558 | { 559 | StringReplace, EnterKeys, EnterKeys, %ActiveChoice%`,,,All 560 | FileDelete, %A_WorkingDir%\bank\enter.csv 561 | FileAppend,%EnterKeys%, %A_WorkingDir%\bank\enter.csv 562 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 563 | } 564 | if ActiveChoice in %TabKeys% 565 | { 566 | StringReplace, TabKeys, TabKeys, %ActiveChoice%`,,,All 567 | FileDelete, %A_WorkingDir%\bank\tab.csv 568 | FileAppend,%TabKeys%, %A_WorkingDir%\bank\tab.csv 569 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 570 | } 571 | if ActiveChoice in %SpaceKeys% 572 | { 573 | StringReplace, SpaceKeys, SpaceKeys, %ActiveChoice%`,,,All 574 | FileDelete, %A_WorkingDir%\bank\space.csv 575 | FileAppend,%SpaceKeys%, %A_WorkingDir%\bank\space.csv 576 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 577 | } 578 | GoSub,GetFileList 579 | GuiControl,,Choice,|%FileList% 580 | GuiControl,,FullText, 581 | GuiControl,,EnterCbox,0 582 | GuiControl,,TabCbox,0 583 | GuiControl,,SpaceCbox,0 584 | } 585 | else 586 | return 587 | return 588 | 589 | ShowString: 590 | GuiControlGet,ActiveChoice,,Choice 591 | if ActiveChoice in %EnterKeys% 592 | { 593 | GuiControl,,EnterCbox,1 594 | } 595 | else 596 | GuiControl,,EnterCbox,0 597 | if ActiveChoice in %TabKeys% 598 | { 599 | GuiControl,,TabCbox,1 600 | } 601 | else 602 | GuiControl,,TabCbox,0 603 | if ActiveChoice in %SpaceKeys% 604 | { 605 | GuiControl,,SpaceCbox,1 606 | } 607 | else 608 | GuiControl,,SpaceCbox,0 609 | 610 | FileRead, Text, %A_WorkingDir%\replacements\%ActiveChoice%.txt 611 | IfInString,Text,::scr:: 612 | { 613 | GuiControl,,TextOrScript,|Text|Script|| 614 | StringReplace,Text,Text,::scr::,, 615 | } 616 | else 617 | GuiControl,,TextOrScript,|Text||Script 618 | GuiControl,,FullText,%Text% 619 | return 620 | 621 | PButtonSave: 622 | GuiControlGet,ActiveChoice,,Choice 623 | GuiControlGet,SaveText,,FullText 624 | GuiControlGet,ToS,,TextOrScript 625 | FileDelete, %A_WorkingDir%\replacements\%ActiveChoice%.txt 626 | if ToS = Text 627 | { 628 | FileAppend,%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 629 | } 630 | else 631 | { 632 | FileAppend,::scr::%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 633 | } 634 | GuiControlGet,ActiveChoice,,Choice 635 | GuiControlGet,EnterCbox,,EnterCbox 636 | GuiControlGet,TabCbox,,TabCbox 637 | GuiControlGet,SpaceCbox,,SpaceCbox 638 | Gosub,SAVE 639 | ;; 640 | return 641 | 642 | PButtonCancel: 643 | Gui,2: Destroy 644 | return 645 | 646 | PButtonOK: 647 | Gui, Submit 648 | GuiControlGet,ActiveChoice,,Choice 649 | GuiControlGet,SaveText,,FullText 650 | GuiControlGet,ToS,,TextOrScript 651 | FileDelete, %A_WorkingDir%\replacements\%ActiveChoice%.txt 652 | if ToS = Text 653 | FileAppend,%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 654 | else 655 | FileAppend,::scr::%SaveText%,%A_WorkingDir%\replacements\%ActiveChoice%.txt 656 | 657 | GuiControlGet,ActiveChoice,,Choice 658 | GuiControlGet,EnterCbox,,EnterCbox 659 | GuiControlGet,TabCbox,,TabCbox 660 | GuiControlGet,SpaceCbox,,SpaceCbox 661 | Gosub,SAVE 662 | 663 | return 664 | 665 | SAVE: 666 | if EnterCbox = 1 667 | { 668 | if ActiveChoice in %EnterKeys% 669 | { 670 | } 671 | else 672 | { 673 | FileAppend,%ActiveChoice%`,, %A_WorkingDir%\bank\enter.csv 674 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 675 | } 676 | } 677 | else 678 | { 679 | if ActiveChoice in %EnterKeys% 680 | { 681 | StringReplace, EnterKeys, EnterKeys, %ActiveChoice%`,,,All 682 | FileDelete, %A_WorkingDir%\bank\enter.csv 683 | FileAppend,%EnterKeys%, %A_WorkingDir%\bank\enter.csv 684 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 685 | } 686 | } 687 | if TabCbox = 1 688 | { 689 | if ActiveChoice in %TabKeys% 690 | { 691 | } 692 | else 693 | { 694 | FileAppend,%ActiveChoice%`,, %A_WorkingDir%\bank\tab.csv 695 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 696 | } 697 | } 698 | else 699 | { 700 | if ActiveChoice in %TabKeys% 701 | { 702 | StringReplace, TabKeys, TabKeys, %ActiveChoice%`,,,All 703 | FileDelete, %A_WorkingDir%\bank\tab.csv 704 | FileAppend,%TabKeys%, %A_WorkingDir%\bank\tab.csv 705 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 706 | } 707 | 708 | } 709 | if SpaceCbox = 1 710 | { 711 | if ActiveChoice in %SpaceKeys% 712 | { 713 | } 714 | else 715 | { 716 | FileAppend,%ActiveChoice%`,, %A_WorkingDir%\bank\space.csv 717 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 718 | } 719 | } 720 | else 721 | { 722 | if ActiveChoice in %SpaceKeys% 723 | { 724 | StringReplace, SpaceKeys, SpaceKeys, %ActiveChoice%`,,,All 725 | FileDelete, %A_WorkingDir%\bank\space.csv 726 | FileAppend,%SpaceKeys%, %A_WorkingDir%\bank\space.csv 727 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 728 | } 729 | 730 | } 731 | return 732 | 733 | RESOURCES: 734 | ;code optimization -- removed IfNotExist tests 735 | ;redundant when final arg to FileInstall is 0 736 | FileInstall,resources\texter.ico,%A_ScriptDir%\resources\texter.ico,0 737 | FileInstall,resources\replace.wav,%A_ScriptDir%\resources\replace.wav,0 738 | FileInstall,resources\texter48x48.png,%A_ScriptDir%\resources\texter48x48.png,0 739 | return 740 | 741 | ;AUTOCLOSE: 742 | ;:*?B0:(::){Left} 743 | ;:*?B0:[::]{Left} 744 | ;:*?B0:{::{}}{Left} 745 | ;return 746 | 747 | EXIT: 748 | ExitApp -------------------------------------------------------------------------------- /Releases/0.2/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.2/texter.exe -------------------------------------------------------------------------------- /Releases/0.3/Texter Installer 0.3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.3/Texter Installer 0.3.exe -------------------------------------------------------------------------------- /Releases/0.3/TexterInstaller.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | #NoTrayIcon 4 | Goto,DIRECTORY 5 | 6 | DIRECTORY: 7 | InstallDir = 8 | Gui, Add, Text,y10 x10,Where would you like to install Texter? 9 | Gui, Add, Edit, x20 y30 r1 W300 vInstallDir,%A_ProgramFiles%\Texter 10 | Gui, Add, Button,w80 GBrowse x320 y29,&Browse 11 | Gui, Add, Button,w80 default GInstall x225 yp+50,&Install 12 | Gui, Add, Button,w80 xp+90 GCancel,&Cancel 13 | Gui, Show, auto,Install Texter 14 | RETURN 15 | 16 | BROWSE: 17 | FileSelectFolder, InstallDir,,1,Select your installation folder 18 | if ErrorLevel = 0 19 | GuiControl,,InstallDir,%InstallDir% 20 | RETURN 21 | 22 | INSTALL: 23 | Gui, Submit 24 | Gui,Destroy 25 | ;MsgBox,%InstallDir% 26 | IfNotExist,%InstallDir% 27 | FileCreateDir,%InstallDir% 28 | Process,Exist,texter.exe 29 | if ErrorLevel != 0 30 | Process,Close,texter.exe 31 | FileInstall,texter.exe,%InstallDir%\texter.exe,1 32 | if ErrorLevel = 0 33 | { 34 | ;MsgBox Problem! 35 | Gui, Add, Text,y10 x10,Texter successfully installed! 36 | Gui, Add, Checkbox, Checked y30 x20 vLaunch, Launch Texter 37 | Gui, Add, Button,w80 default GAutoRun x300 yp+65,&Finish 38 | Gui, Show, auto,Installation complete 39 | } 40 | ;MsgBox, Installed 41 | 42 | return 43 | 44 | AUTORUN: 45 | Gui,Submit 46 | Gui,Destroy 47 | if Launch = 1 48 | { 49 | ;MsgBox, Launch 50 | Run,%InstallDir%\texter.exe 51 | ;MsgBox,Ran: %InstallDir%\texter.exe 52 | } 53 | 54 | Goto,Exit 55 | return 56 | 57 | CANCEL: 58 | Gui, Destroy 59 | Goto,Exit 60 | return 61 | 62 | EXIT: 63 | ExitApp -------------------------------------------------------------------------------- /Releases/0.3/texter.ahk: -------------------------------------------------------------------------------- 1 | ; Texter 2 | ; Author: Adam Pash 3 | ; Gratefully adapted several ideas from AutoClip by Skrommel: 4 | ; http://www.donationcoder.com/Software/Skrommel/index.html#AutoClip 5 | ; Huge thanks to Dustin Luck for his contributions 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 10 | SetWorkingDir %A_ScriptDir% 11 | #SingleInstance,Force 12 | #NoEnv 13 | AutoTrim,off 14 | SetKeyDelay,-1 15 | SetWinDelay,0 16 | Gosub,UpdateCheck 17 | Gosub,READINI 18 | Gosub,RESOURCES 19 | Gosub,TRAYMENU 20 | ;Gosub,AUTOCLOSE 21 | 22 | FileRead, EnterKeys, bank\enter.csv 23 | FileRead, TabKeys, bank\tab.csv 24 | FileRead, SpaceKeys, bank\space.csv 25 | Gosub,GetFileList 26 | Goto Start 27 | 28 | START: 29 | hotkey = 30 | Input,input,V L99,{SC77} 31 | if hotkey In %cancel% 32 | { 33 | SendInput,%hotkey% 34 | Goto,START 35 | } 36 | IfNotInString,FileList,%input%| 37 | { 38 | SendInput,%hotkey% 39 | Goto,START 40 | } 41 | else if hotkey = `{Space`} 42 | { 43 | if input in %SpaceKeys% 44 | { 45 | GoSub, Execute 46 | Goto,START 47 | } 48 | else 49 | { 50 | SendInput,%hotkey% 51 | Goto,Start 52 | } 53 | } 54 | else if hotkey = `{Enter`} 55 | { 56 | if input in %EnterKeys% 57 | { 58 | GoSub, Execute 59 | Goto,START 60 | } 61 | else 62 | { 63 | SendInput,%hotkey% 64 | Goto,Start 65 | } 66 | } 67 | else if hotkey = `{Tab`} 68 | { 69 | if input in %TabKeys% 70 | { 71 | GoSub, Execute 72 | GoTo,Start 73 | } 74 | else 75 | { 76 | SendInput,%hotkey% 77 | Goto,Start 78 | } 79 | } 80 | else 81 | { 82 | SendInput,%hotkey% 83 | Goto,START 84 | } 85 | return 86 | 87 | EXECUTE: 88 | ;; below added b/c SendMode Play appears not to be supported in Vista 89 | if (A_OSVersion = "WIN_VISTA") 90 | SendMode Input 91 | else 92 | SendMode Play 93 | ; Set an option in Preferences to enable for use with Synergy - Use SendMode Input to work with Synergy 94 | SoundPlay, %A_ScriptDir%\resources\replace.wav 95 | ReturnTo := 0 96 | StringLen,BSlength,input 97 | Send, {BS %BSlength%} 98 | FileRead, ReplacementText, replacements\%input%.txt 99 | StringLen,ClipLength,ReplacementText 100 | 101 | IfInString,ReplacementText,::scr:: 102 | { 103 | ;To fix double spacing issue, replace `r`n (return + new line) as AHK sends a new line for each character 104 | StringReplace,ReplacementText,ReplacementText,`r`n,`n, All 105 | StringReplace,Script,ReplacementText,::scr::,, 106 | SendEvent,%Script% 107 | return 108 | } 109 | else 110 | { 111 | ;To fix double spacing issue, replace `r`n (return + new line) as AHK sends a new line for each character 112 | ;(but only in compatibility mode) 113 | if MODE = 0 114 | { 115 | StringReplace,ReplacementText,ReplacementText,`r`n,`n, All 116 | } 117 | IfInString,ReplacementText,`%c 118 | { 119 | StringReplace, ReplacementText, ReplacementText, `%c, %Clipboard%, All 120 | } 121 | IfInString,ReplacementText,`%t 122 | { 123 | FormatTime, CurrTime, , Time 124 | StringReplace, ReplacementText, ReplacementText, `%t, %CurrTime%, All 125 | } 126 | IfInString,ReplacementText,`%ds 127 | { 128 | FormatTime, SDate, , ShortDate 129 | StringReplace, ReplacementText, ReplacementText, `%ds, %SDate%, All 130 | } 131 | IfInString,ReplacementText,`%dl 132 | { 133 | FormatTime, LDate, , LongDate 134 | StringReplace, ReplacementText, ReplacementText, `%dl, %LDate%, All 135 | } 136 | IfInString,ReplacementText,`%| 137 | { 138 | ;in clipboard mode, CursorPoint & ClipLength need to be calculated after replacing `r`n 139 | if MODE = 0 140 | { 141 | MeasurementText := ReplacementText 142 | } 143 | else 144 | { 145 | StringReplace,MeasurementText,ReplacementText,`r`n,`n, All 146 | } 147 | StringGetPos,CursorPoint,MeasurementText,`%| 148 | StringReplace, ReplacementText, ReplacementText, `%|,, All 149 | StringReplace, MeasurementText, MeasurementText, `%|,, All 150 | StringLen,ClipLength,MeasurementText 151 | ReturnTo := ClipLength - CursorPoint 152 | } 153 | 154 | if MODE = 0 155 | { 156 | if ReturnTo > 0 157 | { 158 | if ReplacementText contains !,#,^,+ 159 | { 160 | SendRaw, %ReplacementText% 161 | Send,{Left %ReturnTo%} 162 | } 163 | else 164 | Send,%ReplacementText%{Left %ReturnTo%} 165 | } 166 | else 167 | SendRaw,%ReplacementText% 168 | } 169 | else 170 | { 171 | oldClip = %Clipboard% 172 | Clipboard = %ReplacementText% 173 | if ReturnTo > 0 174 | Send,^v{Left %ReturnTo%} 175 | else 176 | Send,^v 177 | Clipboard = %oldClip% 178 | } 179 | ; if ReturnTo > 0 180 | ; Send, {Left %ReturnTo%} 181 | } 182 | SendMode Event 183 | IniRead,expanded,texter.ini,Stats,Expanded 184 | IniRead,chars_saved,texter.ini,Stats,Characters 185 | expanded += 1 186 | chars_saved += ClipLength 187 | IniWrite,%expanded%,texter.ini,Stats,Expanded 188 | IniWrite,%chars_saved%,texter.ini,Stats,Characters 189 | Return 190 | 191 | HOTKEYS: 192 | StringTrimLeft,hotkey,A_ThisHotkey,1 193 | StringLen,hotkeyl,hotkey 194 | If hotkeyl>1 195 | hotkey=`{%hotkey%`} 196 | Send,{SC77} 197 | Return 198 | 199 | READINI: 200 | IfNotExist bank 201 | FileCreateDir, bank 202 | IfNotExist replacements 203 | FileCreateDir, replacements 204 | IfNotExist resources 205 | FileCreateDir, resources 206 | IniWrite,0.3,texter.ini,Preferences,Version 207 | cancel := GetValFromIni("Cancel","Keys","{Escape}") ;keys to stop completion, remember {} 208 | ignore := GetValFromIni("Ignore","Keys","{Tab}`,{Enter}`,{Space}") ;keys not to send after completion 209 | IniWrite,{Escape}`,{Tab}`,{Enter}`,{Space}`,{Left}`,{Right}`,{Up}`,{Down},texter.ini,Autocomplete,Keys 210 | keys := GetValFromIni("Autocomplete","Keys","{Escape}`,{Tab}`,{Enter}`,{Space}`,{Left}`,{Right}`,{Esc}`,{Up}`,{Down}") 211 | otfhotkey := GetValFromIni("Hotkey","OntheFly","^+H") 212 | managehotkey := GetValFromIni("Hotkey","Management","") 213 | MODE := GetValFromIni("Settings","Mode",0) 214 | EnterBox := GetValFromIni("Triggers","Enter",0) 215 | TabBox := GetValFromIni("Triggers","Tab",0) 216 | SpaceBox := GetValFromIni("Triggers","Space",0) 217 | 218 | ;; Enable hotkeys for creating new keys and managing replacements 219 | if otfhotkey <> 220 | Hotkey,%otfhotkey%,NEWKEY 221 | if managehotkey <> 222 | Hotkey,%managehotkey%,MANAGE 223 | 224 | 225 | ;; Enable triggers (Enter, Tab, Spacebar) 226 | Loop,Parse,keys,`, 227 | { 228 | StringTrimLeft,key,A_LoopField,1 229 | StringTrimRight,key,key,1 230 | StringLen,length,key 231 | If length=0 232 | Hotkey,$`,,HOTKEYS 233 | Else 234 | Hotkey,$%key%,HOTKEYS 235 | } 236 | 237 | ;; This section is intended to exit the input in the Start thread whenever the mouse is clicked or 238 | ;; the user Alt-Tabs to another window so that Texter is prepared 239 | ~LButton::Send,{SC77} 240 | $!Tab:: 241 | { 242 | GetKeyState,capsL,Capslock,T 243 | SetCapsLockState,Off 244 | pressed = 0 245 | Loop { 246 | Sleep,10 247 | GetKeyState,altKey,Alt,P 248 | GetKeyState,tabKey,Tab,P 249 | if (altKey = "D") and (tabKey = "D") 250 | { 251 | if pressed = 0 252 | { 253 | pressed = 1 254 | Send,{Alt down}{Tab} 255 | continue 256 | } 257 | else 258 | { 259 | continue 260 | } 261 | } 262 | else if (altKey = "D") 263 | { 264 | pressed = 0 265 | continue 266 | } 267 | else 268 | { 269 | Send,{Alt up} 270 | break 271 | } 272 | } 273 | Send,{SC77} 274 | if (capsL = "D") 275 | SetCapsLockState,On 276 | } 277 | $!+Tab:: 278 | { 279 | GetKeyState,capsL,Capslock,T 280 | SetCapsLockState,Off 281 | pressed = 0 282 | Loop { 283 | Sleep,10 284 | GetKeyState,altKey,Alt,P 285 | GetKeyState,tabKey,Tab,P 286 | GetKeyState,shiftKey,Shift,P 287 | if (altKey = "D") and (tabKey = "D") and (shiftKey = "D") 288 | { 289 | if pressed = 0 290 | { 291 | pressed = 1 292 | Send,{Alt down}{Shift down}{Tab} 293 | ;Send,{Shift up} 294 | continue 295 | } 296 | else 297 | { 298 | continue 299 | } 300 | } 301 | else if (altKey = "D") and (shiftKey != "D") 302 | { 303 | pressed = 0 304 | Send,{Shift up} 305 | break 306 | } 307 | else if (altKey = "D") and (shiftKey = "D") 308 | { 309 | pressed = 0 310 | continue 311 | } 312 | else 313 | { 314 | Send,{Alt up}{Shift up} 315 | break 316 | } 317 | } 318 | ; Send,{SC77} 319 | if (capsL = "D") 320 | SetCapsLockState,On 321 | } 322 | 323 | Return 324 | 325 | 326 | ;; method written by Dustin Luck for writing to ini 327 | GetValFromIni(section, key, default) 328 | { 329 | IniRead,IniVal,texter.ini,%section%,%key% 330 | if IniVal = ERROR 331 | { 332 | IniWrite,%default%,texter.ini,%section%,%key% 333 | IniVal := default 334 | } 335 | return IniVal 336 | } 337 | 338 | 339 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 340 | NEWKEY: 341 | Gui,1: Destroy 342 | Gui,1: font, s12, Arial 343 | Gui,1: +AlwaysOnTop -SysMenu +ToolWindow ;suppresses taskbar button, always on top, removes minimize/close 344 | Gui,1: Add, Text,x10 y20, Hotstring: 345 | Gui,1: Add, Edit, x13 y45 r1 W65 vRString, 346 | Gui,1: Add, Edit, x100 y45 r4 W395 vFullText, Enter your replacement text here... 347 | Gui,1: Add, Text,x115,Trigger: 348 | Gui,1: Add, Checkbox, vEnterCbox yp x175 Checked%EnterBox%, Enter 349 | Gui,1: Add, Checkbox, vTabCbox yp x242 Checked%TabBox%, Tab 350 | Gui,1: Add, Checkbox, vSpaceCbox yp x305 Checked%SpaceBox%, Space 351 | Gui,1: font, s8, Arial 352 | Gui,1: Add, Button,w80 x320 default,&OK 353 | Gui,1: Add, Button,w80 xp+90 GButtonCancel,&Cancel 354 | Gui,1: font, s12, Arial 355 | Gui,1: Add,DropDownList,x100 y15 vTextOrScript, Text||Script 356 | Gui,1: Add,Picture,x0 y105,resources\texter.png 357 | Gui,1: Show, W500 H200,Add new hotstring... 358 | Hotkey,IfWinActive, Add new hotstring 359 | Hotkey,Esc,ButtonCancel,On 360 | Hotkey,IfWinActive 361 | return 362 | 363 | ButtonCancel: 364 | Gui,1: Destroy 365 | return 366 | 367 | ButtonOK: 368 | GuiControlGet,RString,,RString 369 | IfExist, replacements\%RString%.txt 370 | { 371 | MsgBox,262144,Hotstring already exists, A replacement with the text %Rstring% already exists. Would you like to try again? 372 | return 373 | } 374 | GuiControlGet,EnterCbox,,EnterCbox 375 | GuiControlGet,TabCbox,,TabCbox 376 | GuiControlGet,SpaceCbox,,SpaceCbox 377 | if EnterCbox = 0 378 | if TabCbox = 0 379 | if SpaceCbox = 0 380 | { 381 | MsgBox,262144,Choose a trigger,You need to choose a trigger in order to save a hotstring replacement. 382 | return 383 | } 384 | Gui, Submit 385 | If RString<> 386 | { 387 | if FullText<> 388 | { 389 | if EnterCbox = 1 390 | { 391 | IniWrite,1,texter.ini,Triggers,Enter 392 | FileAppend,%Rstring%`,, bank\enter.csv 393 | FileRead, EnterKeys, bank\enter.csv 394 | if TextOrScript = Script 395 | FullText = ::scr::%FullText% 396 | FileAppend,%FullText%,replacements\%Rstring%.txt 397 | } 398 | else 399 | IniWrite,0,texter.ini,Triggers,Enter 400 | if TabCbox = 1 401 | { 402 | IniWrite,1,texter.ini,Triggers,Tab 403 | FileAppend,%Rstring%`,, bank\tab.csv 404 | FileRead, TabKeys, bank\tab.csv 405 | IfNotExist, replacements\%RString%.txt 406 | { 407 | if TextOrScript = Script 408 | FullText = ::scr::%FullText% 409 | FileAppend,%FullText%,replacements\%Rstring%.txt 410 | } 411 | } 412 | else 413 | IniWrite,0,texter.ini,Triggers,Tab 414 | if SpaceCbox = 1 415 | { 416 | IniWrite,1,texter.ini,Triggers,Space 417 | FileAppend,%Rstring%`,, bank\space.csv 418 | FileRead, SpaceKeys, bank\space.csv 419 | IfNotExist, replacements\%RString%.txt 420 | { 421 | if TextOrScript = Script 422 | FullText = ::scr::%FullText% 423 | FileAppend,%FullText%,replacements\%Rstring%.txt 424 | } 425 | } 426 | else 427 | IniWrite,0,texter.ini,Triggers,Space 428 | } 429 | } 430 | IniRead,EnterBox,texter.ini,Triggers,Enter 431 | IniRead,TabBox,texter.ini,Triggers,Tab 432 | IniRead,SpaceBox,texter.ini,Triggers,Space 433 | Gosub,GetFileList 434 | return 435 | 436 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 437 | 438 | 439 | 440 | TRAYMENU: 441 | Menu,TRAY,NoStandard 442 | Menu,TRAY,DeleteAll 443 | Menu,TRAY,Add,&Manage hotstrings,MANAGE 444 | Menu,TRAY,Add,&Create new hotstring,NEWKEY 445 | Menu,TRAY,Add 446 | Menu,TRAY,Add,P&references...,PREFERENCES 447 | Menu,TRAY,Add,&Help,HELP 448 | Menu,TRAY,Add 449 | Menu,TRAY,Add,&About...,ABOUT 450 | ;Menu,TRAY,Add,&Disable,DISABLE 451 | ;if disable = 1 452 | ; Menu,Tray,Check,&Disable 453 | Menu,TRAY,Add,E&xit,EXIT 454 | Menu,TRAY,Default,&Manage hotstrings 455 | Menu,Tray,Tip,Texter 456 | Menu,TRAY,Icon,resources\texter.ico 457 | Return 458 | 459 | ABOUT: 460 | Gui,4: Destroy 461 | Gui,4: Add,Picture,x200 y0,resources\texter.png 462 | Gui,4: font, s36, Courier New 463 | Gui,4: Add, Text,x10 y35,Texter 464 | Gui,4: font, s8, Courier New 465 | Gui,4: Add, Text,x171 y77,0.3 466 | Gui,4: font, s9, Arial 467 | Gui,4: Add,Text,x10 y110 Center,Texter is a text replacement utility designed to save`nyou countless keystrokes on repetitive text entry by`nreplacing user-defined abbreviations (or hotstrings)`nwith your frequently-used text snippets.`n`nTexter is written by Adam Pash and distributed`nby Lifehacker under the GNU Public License.`nFor details on how to use Texter, check out the 468 | Gui,4:Font,underline bold 469 | Gui,4:Add,Text,cBlue gHomepage Center x110 y230,Texter homepage 470 | Gui,4: Color,F8FAF0 471 | Gui,4: Show,auto,About Texter 472 | Hotkey,IfWinActive, About Texter 473 | Hotkey,Esc,DismissAbout,On 474 | Hotkey,IfWinActive 475 | Return 476 | 477 | DISABLE: 478 | Loop,Parse,keys,`, 479 | { 480 | StringTrimLeft,key,A_LoopField,1 481 | StringTrimRight,key,key,1 482 | StringLen,length,key 483 | If length=0 484 | Hotkey,$`,Toggle 485 | Else 486 | Hotkey,$%key%,Toggle 487 | } 488 | if disable = 0 489 | { 490 | IniWrite,1,texter.ini,Settings,Disable 491 | Menu,Tray,Check,&Disable 492 | } 493 | else 494 | { 495 | IniWrite,0,texter.ini,Settings,Disable 496 | Menu,Tray,Uncheck,&Disable 497 | } 498 | return 499 | 500 | Homepage: 501 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php 502 | return 503 | 504 | BasicUse: 505 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#basic 506 | return 507 | 508 | Scripting: 509 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#advanced 510 | return 511 | 512 | DismissAbout: 513 | Gui,4: Destroy 514 | return 515 | 516 | HELP: 517 | Gui,5: Destroy 518 | Gui,5: Add,Picture,x200 y5,resources\texter.png 519 | Gui,5: font, s36, Courier New 520 | Gui,5: Add, Text,x20 y40,Texter 521 | Gui,5: font, s9, Arial 522 | Gui,5: Add,Text,x19 y285 w300 center,All of Texter's documentation can be found online at the 523 | Gui,5:Font,underline bold 524 | Gui,5:Add,Text,cBlue gHomepage Center x125 y305,Texter homepage 525 | Gui,5: font, s9 norm, Arial 526 | Gui,5: Add,Text,x10 y100 w300,For help by topic, click on one of the following: 527 | Gui,5:Font,underline bold 528 | Gui,5:Add,Text,x30 y120 cBlue gBasicUse,Basic Use: 529 | Gui,5:Font,norm 530 | Gui,5:Add,Text,x50 y140 w280, Covers how to create basic text replacement hotstrings. 531 | Gui,5:Font,underline bold 532 | Gui,5:Add,Text,x30 y180 cBlue gScripting,Sending advanced keystrokes: 533 | Gui,5:Font,norm 534 | Gui,5:Add,Text,x50 y200 w280, Texter is capable of sending advanced keystrokes, like keyboard combinations. This section lists all of the special characters used in script creation, and offers a few examples of how you might use scripts. 535 | Gui,5: Color,F8FAF0 536 | Gui,5: Show,auto,Texter Help 537 | Hotkey,IfWinActive, Texter Help 538 | Hotkey,Esc,DismissHelp,On 539 | Hotkey,IfWinActive 540 | Return 541 | 542 | DismissHelp: 543 | Gui,5: Destroy 544 | return 545 | 546 | GetFileList: 547 | FileList = 548 | Loop, replacements\*.txt 549 | { 550 | FileList = %FileList%%A_LoopFileName%| 551 | } 552 | StringReplace, FileList, FileList, .txt,,All 553 | return 554 | 555 | PREFERENCES: 556 | if otfhotkey<> 557 | HotKey,%otfhotkey%,Off 558 | if managehotkey<> 559 | HotKey,%managehotkey%,Off 560 | Gui,3: Destroy 561 | Gui,3: Add, Tab,x5 y5 w300 h190,General|Print|Stats ;|Import|Export Add these later 562 | Gui,3: Add,Button,x150 y200 w75 GSETTINGSOK Default,&OK 563 | Gui,3: Add,Text,x10 y40,On-the-Fly shortcut: 564 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsotfhotkey, %otfhotkey% 565 | Gui,3: Add,Text,x150 y40,Hotstring Management shortcut: 566 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsmanagehotkey, %managehotkey% 567 | ;code optimization -- use mode value to set in initial radio values 568 | CompatMode := NOT MODE 569 | Gui,3: Add,Radio,x10 y100 vModeGroup Checked%CompatMode%,Compatibility mode (Default) 570 | Gui,3: Add,Radio,Checked%MODE%,Clipboard mode (Faster, but less compatible) 571 | IniRead,OnStartup,texter.ini,Settings,Startup 572 | Gui,3: Add,Checkbox, vStartup x20 yp+30 Checked%OnStartup%,Run Texter at start up 573 | IniRead,Update,texter.ini,Preferences,UpdateCheck 574 | Gui,3: Add,Checkbox, vUpdate x20 yp+20 Checked%Update%,Check for updates at launch? 575 | ;Gui,3: Add,Button,x150 y200 w75 GSETTINGSOK Default,&OK 576 | Gui,3: Add,Button,x230 y200 w75 GSETTINGSCANCEL,&Cancel 577 | Gui,3: Tab,2 578 | Gui,3: Add,Button,w150 h150 gPrintableList,Create Printable Texter Cheatsheet 579 | Gui,3: Add,Text,xp+160 y50 w125 Wrap,Click the big button to export a printable cheatsheet of all your Texter hotstrings, replacements, and triggers. 580 | Gui,3: Tab,3 581 | Gui,3: Add,Text,x10 y40,Your Texter stats: 582 | IniRead,expanded,texter.ini,Stats,Expanded 583 | Gui,3: Add,Text,x25 y60,Snippets expanded: %expanded% 584 | IniRead,chars_saved,texter.ini,Stats,Characters 585 | Gui,3: Add,Text,x25 y80,Characters saved: %chars_saved% 586 | SetFormat,FLOAT,0.2 587 | time_saved := chars_saved/24000 588 | Gui,3: Add,Text,x25 y100,Hours saved: %time_saved% (assuming 400 chars/minute) 589 | ;Gui,3: Add,Button,x150 y200 w75 GSETTINGSOK Default,&OK 590 | ;Gui,3: Add,Button,x230 y200 w75 GSETTINGSCANCEL,&Cancel 591 | Gui,3: Show,AutoSize,Texter Preferences 592 | Hotkey,IfWinActive, Texter Preferences 593 | Hotkey,Esc,SETTINGSCANCEL,On 594 | Hotkey,IfWinActive 595 | Return 596 | 597 | SETTINGSOK: 598 | Gui,3: Submit 599 | If sotfhotkey<> 600 | { 601 | otfhotkey:=sotfhotkey 602 | Hotkey,%otfhotkey%,Newkey 603 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 604 | HotKey,%otfhotkey%,On 605 | } 606 | else 607 | { 608 | otfhotkey:=sotfhotkey 609 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 610 | } 611 | If smanagehotkey<> 612 | { 613 | managehotkey:=smanagehotkey 614 | Hotkey,%managehotkey%,Manage 615 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 616 | HotKey,%managehotkey%,On 617 | } 618 | else 619 | { 620 | managehotkey:=smanagehotkey 621 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 622 | } 623 | ;code optimization -- calculate MODE from ModeGroup 624 | MODE := ModeGroup - 1 625 | IniWrite,%MODE%,texter.ini,Settings,Mode 626 | IniWrite,%Update%,texter.ini,Preferences,UpdateCheck 627 | If Startup = 1 628 | { 629 | IfNotExist %A_StartMenu%\Programs\Startup\Texter.lnk 630 | ;Get icon for shortcut link: 631 | ;1st from compiled EXE 632 | if %A_IsCompiled% 633 | { 634 | IconLocation=%A_ScriptFullPath% 635 | } 636 | ;2nd from icon in resources folder 637 | else IfExist resources\texter.ico 638 | { 639 | IconLocation=resources\texter.ico 640 | } 641 | ;3rd from the AutoHotkey application itself 642 | else 643 | { 644 | IconLocation=%A_AhkPath% 645 | } 646 | ;use %A_ScriptFullPath% instead of texter.exe 647 | ;to allow compatibility with source version 648 | FileCreateShortcut,%A_ScriptFullPath%,%A_StartMenu%\Programs\Startup\Texter.lnk,%A_WorkingDir%,,Text replacement system tray application,%IconLocation% 649 | } 650 | else 651 | { 652 | IfExist %A_StartMenu%\Programs\Startup\Texter.lnk 653 | { 654 | FileDelete %A_StartMenu%\Programs\Startup\Texter.lnk 655 | } 656 | } 657 | IniWrite,%Startup%,texter.ini,Settings,Startup 658 | 659 | Return 660 | 661 | SETTINGSCANCEL: 662 | Gui,3:Destroy 663 | if otfhotkey<> 664 | HotKey,%otfhotkey%,On 665 | if managehotkey <> 666 | HotKey,%managehotkey%,On 667 | Return 668 | 669 | MANAGE: 670 | GoSub,GetFileList 671 | StringReplace, FileList, FileList, .txt,,All 672 | Gui,2: Destroy 673 | Gui,2: font, s12, Arial 674 | Gui,2: Add, Text,x15 y20, Hotstring: 675 | Gui,2: Add, ListBox, x13 y40 r15 W100 vChoice gShowString Sort,%FileList% 676 | Gui,2: Add,DropDownList,x+20 y15 vTextOrScript, Text||Script 677 | Gui,2: Add, Edit, xp y45 r12 W460 vFullText, 678 | Gui,2: Add, Text,y282 x150,Trigger: 679 | Gui,2: Add, Checkbox, vEnterCbox yp xp+60, Enter 680 | Gui,2: Add, Checkbox, vTabCbox yp xp+65, Tab 681 | Gui,2: Add, Checkbox, vSpaceCbox yp xp+60, Space 682 | Gui,2: font, s8, Arial 683 | Gui,2: Add,Button,w80 GPButtonSave yp x500,&Save 684 | Gui,2: Add, Button,w80 default GPButtonOK x420 yp+80,&OK 685 | Gui,2: Add, Button,w80 xp+90 GPButtonCancel,&Cancel 686 | Gui,2: font, s12, Arial 687 | Gui,2: Add, Button, w35 x20 y320 GAdd,+ 688 | Gui,2: Add, Button, w35 x60 y320 GDelete,- 689 | Gui,2: Show, W600 h400, Texter Management 690 | Hotkey,IfWinActive, Texter Management 691 | Hotkey,Esc,PButtonCancel,On 692 | Hotkey,!p,Preferences 693 | Hotkey,IfWinActive 694 | return 695 | 696 | ADD: 697 | Loop,Parse,keys,`, 698 | { 699 | StringTrimLeft,key,A_LoopField,1 700 | StringTrimRight,key,key,1 701 | StringLen,length,key 702 | If length=0 703 | Hotkey,$`,,Off 704 | Else 705 | Hotkey,$%key%,Off 706 | } 707 | GoSub,Newkey 708 | IfWinExist,Add new hotstring... 709 | { 710 | WinWaitClose,Add new hotstring...,, 711 | } 712 | GoSub,GetFileList 713 | StringReplace, FileList, FileList,|%RString%|,|%RString%|| 714 | GuiControl,,Choice,|%FileList% 715 | GoSub,ShowString 716 | Loop,Parse,keys,`, 717 | { 718 | StringTrimLeft,key,A_LoopField,1 719 | StringTrimRight,key,key,1 720 | StringLen,length,key 721 | If length=0 722 | Hotkey,$`,,On 723 | Else 724 | Hotkey,$%key%,On 725 | } 726 | return 727 | 728 | DELETE: 729 | GuiControlGet,ActiveChoice,,Choice 730 | MsgBox,1,Confirm Delete,Are you sure you want to delete this hotstring: %ActiveChoice% 731 | IfMsgBox, OK 732 | { 733 | FileDelete,replacements\%ActiveChoice%.txt 734 | if ActiveChoice in %EnterKeys% 735 | { 736 | StringReplace, EnterKeys, EnterKeys, %ActiveChoice%`,,,All 737 | FileDelete, bank\enter.csv 738 | FileAppend,%EnterKeys%, bank\enter.csv 739 | FileRead, EnterKeys, bank\enter.csv 740 | } 741 | if ActiveChoice in %TabKeys% 742 | { 743 | StringReplace, TabKeys, TabKeys, %ActiveChoice%`,,,All 744 | FileDelete, bank\tab.csv 745 | FileAppend,%TabKeys%, bank\tab.csv 746 | FileRead, TabKeys, bank\tab.csv 747 | } 748 | if ActiveChoice in %SpaceKeys% 749 | { 750 | StringReplace, SpaceKeys, SpaceKeys, %ActiveChoice%`,,,All 751 | FileDelete, bank\space.csv 752 | FileAppend,%SpaceKeys%, bank\space.csv 753 | FileRead, SpaceKeys, bank\space.csv 754 | } 755 | GoSub,GetFileList 756 | GuiControl,,Choice,|%FileList% 757 | GuiControl,,FullText, 758 | GuiControl,,EnterCbox,0 759 | GuiControl,,TabCbox,0 760 | GuiControl,,SpaceCbox,0 761 | } 762 | else 763 | return 764 | return 765 | 766 | ShowString: 767 | GuiControlGet,ActiveChoice,,Choice 768 | if ActiveChoice in %EnterKeys% 769 | { 770 | GuiControl,,EnterCbox,1 771 | } 772 | else 773 | GuiControl,,EnterCbox,0 774 | if ActiveChoice in %TabKeys% 775 | { 776 | GuiControl,,TabCbox,1 777 | } 778 | else 779 | GuiControl,,TabCbox,0 780 | if ActiveChoice in %SpaceKeys% 781 | { 782 | GuiControl,,SpaceCbox,1 783 | } 784 | else 785 | GuiControl,,SpaceCbox,0 786 | 787 | FileRead, Text, replacements\%ActiveChoice%.txt 788 | IfInString,Text,::scr:: 789 | { 790 | GuiControl,,TextOrScript,|Text|Script|| 791 | StringReplace,Text,Text,::scr::,, 792 | } 793 | else 794 | GuiControl,,TextOrScript,|Text||Script 795 | GuiControl,,FullText,%Text% 796 | return 797 | 798 | PButtonSave: 799 | GuiControlGet,ActiveChoice,,Choice 800 | GuiControlGet,SaveText,,FullText 801 | GuiControlGet,ToS,,TextOrScript 802 | FileDelete, replacements\%ActiveChoice%.txt 803 | if ToS = Text 804 | { 805 | FileAppend,%SaveText%,replacements\%ActiveChoice%.txt 806 | } 807 | else 808 | { 809 | FileAppend,::scr::%SaveText%,replacements\%ActiveChoice%.txt 810 | } 811 | GuiControlGet,ActiveChoice,,Choice 812 | GuiControlGet,EnterCbox,,EnterCbox 813 | GuiControlGet,TabCbox,,TabCbox 814 | GuiControlGet,SpaceCbox,,SpaceCbox 815 | Gosub,SAVE 816 | ;; 817 | return 818 | 819 | PButtonCancel: 820 | Gui,2: Destroy 821 | return 822 | 823 | PButtonOK: 824 | Gui, Submit 825 | GuiControlGet,ActiveChoice,,Choice 826 | GuiControlGet,SaveText,,FullText 827 | GuiControlGet,ToS,,TextOrScript 828 | FileDelete, replacements\%ActiveChoice%.txt 829 | if ToS = Text 830 | FileAppend,%SaveText%,replacements\%ActiveChoice%.txt 831 | else 832 | FileAppend,::scr::%SaveText%,replacements\%ActiveChoice%.txt 833 | 834 | GuiControlGet,ActiveChoice,,Choice 835 | GuiControlGet,EnterCbox,,EnterCbox 836 | GuiControlGet,TabCbox,,TabCbox 837 | GuiControlGet,SpaceCbox,,SpaceCbox 838 | Gosub,SAVE 839 | 840 | return 841 | 842 | SAVE: 843 | if EnterCbox = 1 844 | { 845 | if ActiveChoice in %EnterKeys% 846 | { 847 | } 848 | else 849 | { 850 | FileAppend,%ActiveChoice%`,, bank\enter.csv 851 | FileRead, EnterKeys, bank\enter.csv 852 | } 853 | } 854 | else 855 | { 856 | if ActiveChoice in %EnterKeys% 857 | { 858 | StringReplace, EnterKeys, EnterKeys, %ActiveChoice%`,,,All 859 | FileDelete, bank\enter.csv 860 | FileAppend,%EnterKeys%, bank\enter.csv 861 | FileRead, EnterKeys, bank\enter.csv 862 | } 863 | } 864 | if TabCbox = 1 865 | { 866 | if ActiveChoice in %TabKeys% 867 | { 868 | } 869 | else 870 | { 871 | FileAppend,%ActiveChoice%`,, bank\tab.csv 872 | FileRead, TabKeys, bank\tab.csv 873 | } 874 | } 875 | else 876 | { 877 | if ActiveChoice in %TabKeys% 878 | { 879 | StringReplace, TabKeys, TabKeys, %ActiveChoice%`,,,All 880 | FileDelete, bank\tab.csv 881 | FileAppend,%TabKeys%, bank\tab.csv 882 | FileRead, TabKeys, bank\tab.csv 883 | } 884 | 885 | } 886 | if SpaceCbox = 1 887 | { 888 | if ActiveChoice in %SpaceKeys% 889 | { 890 | } 891 | else 892 | { 893 | FileAppend,%ActiveChoice%`,, bank\space.csv 894 | FileRead, SpaceKeys, bank\space.csv 895 | } 896 | } 897 | else 898 | { 899 | if ActiveChoice in %SpaceKeys% 900 | { 901 | StringReplace, SpaceKeys, SpaceKeys, %ActiveChoice%`,,,All 902 | FileDelete, bank\space.csv 903 | FileAppend,%SpaceKeys%, bank\space.csv 904 | FileRead, SpaceKeys, bank\space.csv 905 | } 906 | 907 | } 908 | return 909 | 910 | RESOURCES: 911 | ;code optimization -- removed IfNotExist tests 912 | ;redundant when final arg to FileInstall is 0 913 | FileInstall,resources\texter.ico,%A_ScriptDir%\resources\texter.ico,1 914 | FileInstall,resources\replace.wav,%A_ScriptDir%\resources\replace.wav,0 915 | FileInstall,resources\texter.png,%A_ScriptDir%\resources\texter.png,1 916 | FileInstall,resources\style.css,%A_ScriptDir%\resources\style.css,0 917 | return 918 | 919 | ;AUTOCLOSE: 920 | ;:*?B0:(::){Left} 921 | ;:*?B0:[::]{Left} 922 | ;:*?B0:{::{}}{Left} 923 | ;return 924 | 925 | PrintableList: 926 | alt := 0 927 | List = Texter Hotstrings and Replacement Text Cheatsheet

Texter Hostrings and Replacement Text Cheatsheet

Hotstring

Replacement Text

Trigger(s)

928 | Loop, replacements\*.txt 929 | { 930 | alt := 1 - alt 931 | trig = 932 | hs = %A_LoopFileName% 933 | StringReplace, hs, hs, .txt 934 | FileRead, rp, replacements\%hs%.txt 935 | If hs in %EnterKeys% 936 | trig = Enter 937 | If hs in %TabKeys% 938 | trig = %trig% Tab 939 | If hs in %SpaceKeys% 940 | trig = %trig% Space 941 | StringReplace, rp, rp, <,<,All 942 | StringReplace, rp, rp, >,>,All 943 | List = %List%
%hs%%rp%%trig%

944 | 945 | } 946 | List = %List% 947 | IfExist resources\Texter Replacement Guide.html 948 | FileDelete,resources\Texter Replacement Guide.html 949 | FileAppend,%List%, resources\Texter Replacement Guide.html 950 | Run,resources\Texter Replacement Guide.html 951 | return 952 | 953 | 954 | UpdateCheck: ;;;;;;; Update the version number on each new release ;;;;;;;;;;;;; 955 | IfNotExist texter.ini 956 | { 957 | MsgBox,4,Check for Updates?,Would you like to automatically check for updates when on startup? 958 | IfMsgBox,Yes 959 | updatereply = 1 960 | else 961 | updatereply = 0 962 | } 963 | update := GetValFromIni("Preferences","UpdateCheck",updatereply) 964 | IniWrite,0.3,texter.ini,Preferences,Version 965 | if (update = 1) 966 | SetTimer,RunUpdateCheck,10000 967 | return 968 | 969 | RunUpdateCheck: 970 | update("texter") 971 | return 972 | 973 | update(program) { 974 | SetTimer, RunUpdateCheck, Off 975 | UrlDownloadToFile,http://svn.adampash.com/%program%/CurrentVersion.txt,VersionCheck.txt 976 | if ErrorLevel = 0 977 | { 978 | FileReadLine, Latest, VersionCheck.txt,1 979 | IniRead,Current,%program%.ini,Preferences,Version 980 | ;MsgBox,Latest: %Latest% `n Current: %Current% 981 | if (Latest > Current) 982 | { 983 | MsgBox,4,A new version of %program% is available!,Would you like to visit the %program% homepage and download the latest version? 984 | IfMsgBox,Yes 985 | Goto,Homepage 986 | } 987 | FileDelete,VersionCheck.txt ;; delete version check 988 | } 989 | } 990 | 991 | return 992 | EXIT: 993 | ExitApp -------------------------------------------------------------------------------- /Releases/0.3/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.3/texter.exe -------------------------------------------------------------------------------- /Releases/0.4/Texter Installer 0.4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.4/Texter Installer 0.4.exe -------------------------------------------------------------------------------- /Releases/0.4/TexterInstaller.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | #NoTrayIcon 4 | Goto,DIRECTORY 5 | 6 | DIRECTORY: 7 | InstallDir = 8 | Gui, Add, Text,y10 x10,Where would you like to install Texter? 9 | Gui, Add, Edit, x20 y30 r1 W300 vInstallDir,%A_ProgramFiles%\Texter 10 | Gui, Add, Button,w80 GBrowse x320 y29,&Browse 11 | Gui, Add, Button,w80 default GInstall x225 yp+50,&Install 12 | Gui, Add, Button,w80 xp+90 GCancel,&Cancel 13 | Gui, Show, auto,Install Texter 14 | RETURN 15 | 16 | BROWSE: 17 | FileSelectFolder, InstallDir,,1,Select your installation folder 18 | if ErrorLevel = 0 19 | GuiControl,,InstallDir,%InstallDir% 20 | RETURN 21 | 22 | INSTALL: 23 | Gui, Submit 24 | Gui,Destroy 25 | ;MsgBox,%InstallDir% 26 | IfNotExist,%InstallDir% 27 | FileCreateDir,%InstallDir% 28 | Process,Exist,texter.exe 29 | if ErrorLevel != 0 30 | Process,Close,texter.exe 31 | FileInstall,texter.exe,%InstallDir%\texter.exe,1 32 | if ErrorLevel = 0 33 | { 34 | ;MsgBox Problem! 35 | Gui, Add, Text,y10 x10,Texter successfully installed! 36 | Gui, Add, Checkbox, Checked y30 x20 vLaunch, Launch Texter 37 | Gui, Add, Button,w80 default GAutoRun x300 yp+65,&Finish 38 | Gui, Show, auto,Installation complete 39 | } 40 | ;MsgBox, Installed 41 | 42 | return 43 | 44 | AUTORUN: 45 | Gui,Submit 46 | Gui,Destroy 47 | if Launch = 1 48 | { 49 | ;MsgBox, Launch 50 | Run,%InstallDir%\texter.exe 51 | ;MsgBox,Ran: %InstallDir%\texter.exe 52 | } 53 | 54 | Goto,Exit 55 | return 56 | 57 | CANCEL: 58 | Gui, Destroy 59 | Goto,Exit 60 | return 61 | 62 | EXIT: 63 | ExitApp -------------------------------------------------------------------------------- /Releases/0.4/texter.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.4/texter.ahk -------------------------------------------------------------------------------- /Releases/0.4/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.4/texter.exe -------------------------------------------------------------------------------- /Releases/0.5/Texter Installer 0.5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.5/Texter Installer 0.5.exe -------------------------------------------------------------------------------- /Releases/0.5/TexterInstaller.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | #NoTrayIcon 4 | Goto,DIRECTORY 5 | 6 | DIRECTORY: 7 | InstallDir = 8 | Gui, Add, Text,y10 x10,Where would you like to install Texter? 9 | Gui, Add, Edit, x20 y30 r1 W300 vInstallDir,%A_ProgramFiles%\Texter 10 | Gui, Add, Button,w80 GBrowse x320 y29,&Browse 11 | Gui, Add, Button,w80 default GInstall x225 yp+50,&Install 12 | Gui, Add, Button,w80 xp+90 GCancel,&Cancel 13 | Gui, Show, auto,Install Texter 14 | RETURN 15 | 16 | BROWSE: 17 | FileSelectFolder, InstallDir,,1,Select your installation folder 18 | if ErrorLevel = 0 19 | GuiControl,,InstallDir,%InstallDir% 20 | RETURN 21 | 22 | INSTALL: 23 | Gui, Submit 24 | Gui,Destroy 25 | ;MsgBox,%InstallDir% 26 | IfNotExist,%InstallDir% 27 | FileCreateDir,%InstallDir% 28 | Process,Exist,texter.exe 29 | if ErrorLevel != 0 30 | Process,Close,texter.exe 31 | FileInstall,texter.exe,%InstallDir%\texter.exe,1 32 | if ErrorLevel = 0 33 | { 34 | ;MsgBox Problem! 35 | Gui, Add, Text,y10 x10,Texter successfully installed! 36 | Gui, Add, Checkbox, Checked y30 x20 vLaunch, Launch Texter 37 | Gui, Add, Button,w80 default GAutoRun x300 yp+65,&Finish 38 | Gui, Show, auto,Installation complete 39 | } 40 | ;MsgBox, Installed 41 | 42 | return 43 | 44 | AUTORUN: 45 | Gui,Submit 46 | Gui,Destroy 47 | if Launch = 1 48 | { 49 | ;MsgBox, Launch 50 | Run,%InstallDir%\texter.exe 51 | ;MsgBox,Ran: %InstallDir%\texter.exe 52 | } 53 | 54 | Goto,Exit 55 | return 56 | 57 | CANCEL: 58 | Gui, Destroy 59 | Goto,Exit 60 | return 61 | 62 | EXIT: 63 | ExitApp -------------------------------------------------------------------------------- /Releases/0.5/texter.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.5/texter.ahk -------------------------------------------------------------------------------- /Releases/0.5/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.5/texter.exe -------------------------------------------------------------------------------- /Releases/0.6/Texter Installer 0.6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.6/Texter Installer 0.6.exe -------------------------------------------------------------------------------- /Releases/0.6/texter.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.6/texter.ahk -------------------------------------------------------------------------------- /Releases/0.6/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/Releases/0.6/texter.exe -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | - Bugs: 2 | - Mouse incompatibility with Outlook? -------------------------------------------------------------------------------- /TexterInstaller.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | #NoTrayIcon 4 | Goto,DIRECTORY 5 | 6 | DIRECTORY: 7 | InstallDir = 8 | Gui, Add, Text,y10 x10,Where would you like to install Texter? 9 | Gui, Add, Edit, x20 y30 r1 W300 vInstallDir,%A_ProgramFiles%\Texter 10 | Gui, Add, Button,w80 GBrowse x320 y29,&Browse 11 | Gui, Add, Button,w80 default GInstall x225 yp+50,&Install 12 | Gui, Add, Button,w80 xp+90 GCancel,&Cancel 13 | Gui, Show, auto,Install Texter 14 | RETURN 15 | 16 | BROWSE: 17 | FileSelectFolder, InstallDir,,1,Select your installation folder 18 | if ErrorLevel = 0 19 | GuiControl,,InstallDir,%InstallDir% 20 | RETURN 21 | 22 | INSTALL: 23 | Gui, Submit 24 | Gui,Destroy 25 | ;MsgBox,%InstallDir% 26 | IfNotExist,%InstallDir% 27 | FileCreateDir,%InstallDir% 28 | Process,Exist,texter.exe 29 | if ErrorLevel != 0 30 | Process,Close,texter.exe 31 | FileInstall,texter.exe,%InstallDir%\texter.exe,1 32 | if ErrorLevel = 0 33 | { 34 | ;MsgBox Problem! 35 | Gui, Add, Text,y10 x10,Texter successfully installed! 36 | Gui, Add, Checkbox, Checked y30 x20 vLaunch, Launch Texter 37 | Gui, Add, Button,w80 default GAutoRun x300 yp+65,&Finish 38 | Gui, Show, auto,Installation complete 39 | } 40 | ;MsgBox, Installed 41 | 42 | return 43 | 44 | AUTORUN: 45 | Gui,Submit 46 | Gui,Destroy 47 | if Launch = 1 48 | { 49 | ;MsgBox, Launch 50 | Run,%InstallDir%\texter.exe 51 | ;MsgBox,Ran: %InstallDir%\texter.exe 52 | } 53 | 54 | Goto,Exit 55 | return 56 | 57 | CANCEL: 58 | Gui, Destroy 59 | Goto,Exit 60 | return 61 | 62 | EXIT: 63 | ExitApp -------------------------------------------------------------------------------- /export.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | SetWorkingDir, "%A_ScriptDir%" 4 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 5 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 6 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 7 | Gosub,Export 8 | 9 | return 10 | 11 | 12 | EXPORT: 13 | Loop,bundles\*,2 14 | { 15 | Bundles = %Bundles%|%A_LoopFileName% 16 | thisBundle = %A_LoopFileName% 17 | Loop,bundles\%A_LoopFileName%\replacements\*.txt 18 | { 19 | thisBundle = %thisBundle%%A_LoopFileName%| 20 | } 21 | StringReplace, thisBundle, thisBundle, .txt,,All 22 | StringReplace, thisBundle, thisBundle, %A_LoopFileName%,, 23 | %A_LoopFileName% = %thisBundle% 24 | } 25 | StringReplace, FileList, FileList, .txt,,All 26 | Gui,5: Destroy 27 | Gui,5: font, s12, Arial 28 | Gui,5: Add, Text,x15 y20, Hotstring: 29 | Gui,5: Add, ListBox, 0x8 x13 y40 r15 W100 vExportChoice gShowString Sort,%FileList% 30 | Gui,5: Add, Button,w80 default GExportOK x420 yp+80,&Export 31 | Gui,5: Show, W600 H400, Texter Management 32 | return 33 | 34 | ExportOK: 35 | Gui, 5: Submit 36 | Gui, 5: Destroy 37 | IfNotExist %A_WorkingDir%\Texter Export 38 | FileCreateDir,%A_WorkingDir%\Texter Export 39 | Loop,Parse,ExportChoice,| 40 | { 41 | FileCopy,%A_WorkingDir%\replacements\%A_LoopField%.txt,%A_WorkingDir%\Texter Export\%A_LoopField%.txt 42 | if A_LoopField in %EnterKeys% 43 | FileAppend,%A_LoopField%`,,%A_WorkingDir%\Texter Export\enter.csv 44 | if A_LoopField in %TabKeys% 45 | FileAppend,%A_LoopField%`,,%A_WorkingDir%\Texter Export\tab.csv 46 | if A_LoopField in %SpaceKeys% 47 | FileAppend,%A_LoopField%`,,%A_WorkingDir%\Texter Export\space.csv 48 | } 49 | 50 | return 51 | 52 | GetFileList: 53 | FileList = 54 | Loop, %A_WorkingDir%\replacements\*.txt 55 | { 56 | FileList = %FileList%%A_LoopFileName%| 57 | } 58 | StringReplace, FileList, FileList, .txt,,All 59 | return 60 | 61 | ShowString: 62 | 63 | return -------------------------------------------------------------------------------- /import.ahk: -------------------------------------------------------------------------------- 1 | ; Mostly complete - just need to do a bit of testing, 2 | ; then set up for actual import/append to .csv files 3 | 4 | 5 | #SingleInstance,Force 6 | #NoEnv 7 | SetWorkingDir, "%A_ScriptDir%" 8 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 9 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 10 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 11 | Gosub,Import 12 | 13 | return 14 | 15 | 16 | IMPORT: 17 | FileSelectFolder,ImportFrom,,,Select the Texter import folder 18 | Gosub,GetFileList 19 | Loop,%ImportFrom%\*.txt 20 | { 21 | ;StringReplace,A_LoopField,A_LoopField,.txt,, 22 | ;rp_import = %rp_import%%A_LoopField% 23 | MsgBox,%A_LoopFileFullPath% 24 | FileCreateDir,%A_WorkingDir%\Import 25 | FileCopy,%A_LoopFileFullPath%,%A_WorkingDir%\Import 26 | 27 | } 28 | FileRead, ImportEnter, %ImportFrom%\enter.csv 29 | FileRead, ImportTab, %ImportFrom%\tab.csv 30 | FileRead, ImportSpace, %ImportFrom%\space.csv 31 | Loop,Parse,ImportEnter,| 32 | { 33 | if A_LoopField not in %EnterKeys% 34 | FileAppend,%A_LoopField%`,,%A_WorkingDir%\Import\enter.csv 35 | } 36 | Loop,Parse,ImportTab,| 37 | { 38 | if A_LoopField not in %TabKeys% 39 | FileAppend,%A_LoopField%`,,%A_WorkingDir%\Import\tab.csv 40 | 41 | } 42 | Loop,Parse,ImportSpace,| 43 | { 44 | if A_LoopField not in %SpaceKeys% 45 | FileAppend,%A_LoopField%`,,%A_WorkingDir%\Import\space.csv 46 | } 47 | return 48 | 49 | 50 | GetFileList: 51 | FileList = 52 | Loop, %A_WorkingDir%\replacements\*.txt 53 | { 54 | FileList = %FileList%%A_LoopFileName%| 55 | } 56 | StringReplace, FileList, FileList, .txt,,All 57 | return -------------------------------------------------------------------------------- /includes/GUI/about_GUI.ahk: -------------------------------------------------------------------------------- 1 | ABOUT: 2 | Gui,4: Destroy 3 | Gui,4: +owner 4 | Gui,4: Add,Picture,x200 y0,%TexterPNG% 5 | Gui,4: font, s36, Courier New 6 | Gui,4: Add, Text,x10 y35,Texter 7 | Gui,4: font, s8, Courier New 8 | Gui,4: Add, Text,x171 y77,%Version% 9 | Gui,4: font, s9, Arial 10 | Gui,4: Add,Text,x10 y110 Center,Texter is a text replacement utility designed to save`nyou countless keystrokes on repetitive text entry by`nreplacing user-defined abbreviations (or hotstrings)`nwith your frequently-used text snippets.`n`nTexter is written by Adam Pash and distributed`nby Lifehacker under the GNU Public License.`nFor details on how to use Texter, check out the 11 | Gui,4:Font,underline bold 12 | Gui,4:Add,Text,cBlue gHomepage Center x110 y230,Texter homepage 13 | Gui,4: Color,F8FAF0 14 | Gui 2:+Disabled 15 | Gui,4: Show,auto,About Texter 16 | Return 17 | 18 | 4GuiClose: 19 | 4GuiEscape: 20 | DismissAbout: 21 | Gui 2:-Disabled 22 | Gui,4: Destroy 23 | return 24 | -------------------------------------------------------------------------------- /includes/GUI/disablechecks.ahk: -------------------------------------------------------------------------------- 1 | DisableChecks: 2 | 3 | CheckedCbox = %A_GuiControl% 4 | if (CheckedCbox = "NoTrigCbox") 5 | { 6 | GuiControl,,EnterCbox,0 7 | GuiControl,,TabCbox,0 8 | GuiControl,,SpaceCbox,0 9 | } 10 | else 11 | { 12 | GuiControl,,NoTrigCbox,0 13 | } 14 | return -------------------------------------------------------------------------------- /includes/GUI/help_GUI.ahk: -------------------------------------------------------------------------------- 1 | HELP: 2 | Gui,5: Destroy 3 | Gui,5: +owner 4 | Gui,5: Add,Picture,x200 y5,%TexterPNG% 5 | Gui,5: font, s36, Courier New 6 | Gui,5: Add, Text,x20 y40,Texter 7 | Gui,5: font, s9, Arial 8 | Gui,5: Add,Text,x19 y285 w300 center,All of Texter's documentation can be found online at the 9 | Gui,5:Font,underline bold 10 | Gui,5:Add,Text,cBlue gHomepage Center x125 y305,Texter homepage 11 | Gui,5: font, s9 norm, Arial 12 | Gui,5: Add,Text,x10 y100 w300,For help by topic, click on one of the following: 13 | Gui,5:Font,underline bold 14 | Gui,5:Add,Text,x30 y120 cBlue gBasicUse,Basic Use: 15 | Gui,5:Font,norm 16 | Gui,5:Add,Text,x50 y140 w280, Covers how to create basic text replacement hotstrings. 17 | Gui,5:Font,underline bold 18 | Gui,5:Add,Text,x30 y180 cBlue gScripting,Sending advanced keystrokes: 19 | Gui,5:Font,norm 20 | Gui,5:Add,Text,x50 y200 w280, Texter is capable of sending advanced keystrokes, like keyboard combinations. This section lists all of the special characters used in script creation, and offers a few examples of how you might use scripts. 21 | Gui,5: Color,F8FAF0 22 | Gui,5: Show,auto,Texter Help 23 | Return 24 | 25 | 5GuiEscape: 26 | DismissHelp: 27 | Gui,5: Destroy 28 | return 29 | -------------------------------------------------------------------------------- /includes/GUI/management_GUI.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Implementation and GUI for management ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | MAINWINTOOLBAR: 3 | Menu, ToolsMenu, Add, P&references..., Preferences 4 | Menu, MgmtMenuBar, Add, &Tools, :ToolsMenu 5 | Menu, BundlesMenu, Add, &Export, Export 6 | Menu, BundlesMenu, Add, &Import, Import 7 | Menu, BundlesMenu, Add, &Add, AddBundle 8 | Menu, BundlesMenu, Add, &Remove, DeleteBundle 9 | Menu, MgmtMenuBar, Add, &Bundles, :BundlesMenu 10 | Menu, HelpMenu, Add, &Basic Use, BasicUse 11 | Menu, HelpMenu, Add, Ad&vanced Use, Scripting 12 | Menu, HelpMenu, Add, &Homepage, Homepage 13 | Menu, HelpMenu, Add, &About..., About 14 | Menu, MgmtMenuBar, Add, &Help, :HelpMenu 15 | Gui,2: Menu, MgmtMenuBar 16 | return 17 | 18 | 2GuiContextMenu: 19 | if A_GuiControl = Choice 20 | { 21 | Menu,RcMenu,Add 22 | Menu,RcMenu,DeleteAll 23 | Send,{LButton} 24 | GuiControlGet, editThis, ,Choice 25 | Menu,RcMenu,Add,Rename %editThis% hotstring...,EditName 26 | Menu,RcMenu,Show, %A_GuiX%, %A_GuiY% 27 | } 28 | return 29 | 30 | MANAGE: 31 | Gui,2: Destroy 32 | Gosub,MAINWINTOOLBAR 33 | GoSub,GetFileList 34 | Bundles = 35 | Loop,bundles\*,2 36 | { 37 | thisBundle = %A_LoopFileName% 38 | if (thisBundle != "Autocorrect") 39 | { 40 | Bundles = %Bundles%|%A_LoopFileName% 41 | ; Loop,bundles\%A_LoopFileName%\replacements\*.txt 42 | ; { 43 | ; thisReplacement:=Dehexify(A_LoopFileName) 44 | ; thisBundle = %thisBundle%%thisReplacement%| 45 | ; } 46 | StringReplace, thisBundle, thisBundle, .txt,,All 47 | StringReplace, thisBundle, thisBundle, %A_LoopFileName%,, 48 | %A_LoopFileName% = %thisBundle% 49 | } 50 | } 51 | StringReplace, FileList, FileList, .txt,,All 52 | StringTrimLeft,Bundles,Bundles,1 53 | Gui,2: Default 54 | Gui,2: Font, s12, Arial 55 | Gui,2: Add,Tab,x5 y5 h390 w597 vBundleTabs gListBundle,Default|%Bundles% ;;;;;; START ADDING BUNDLES 56 | Gui,2: Add, Text, Section, 57 | Gui,2: Tab ;;; Every control after this point belongs to no individual tab 58 | Gui,2: Add, Text,ys xs,Hotstring: 59 | Gui,2: Add, ListBox, xs r15 W100 vChoice gShowString Sort, %FileList% 60 | Gui,2: Add, Button, w35 xs+10 GAdd,+ 61 | Gui,2: Add, Button, w35 xp+40 GDelete,- 62 | Gui,2: Add, DropDownList, Section ys vTextOrScript, Text||Script 63 | Gui,2: Font, s12, Arial 64 | Gui,2: Add, Edit, r12 W460 xs vFullText 65 | Gui,2: Add, Text, xs,Trigger: 66 | Gui,2: Add, Checkbox, gDisableChecks vEnterCbox yp xp+65, Enter 67 | Gui,2: Add, Checkbox, gDisableChecks vTabCbox yp xp+65, Tab 68 | Gui,2: Add, Checkbox, gDisableChecks vSpaceCbox yp xp+60, Space 69 | Gui,2: Add, Checkbox, gDisableChecks vNoTrigCbox yp xp+80, Instant 70 | Gui,2: Font, s8, Arial 71 | Gui,2: Add,Button, w80 vSaveButton gPButtonSave xs+375 yp, &Save Hotstring 72 | IniRead,bundleCheck,texter.ini,Bundles,Default 73 | Gui,2: Add, Checkbox, Checked%bundleCheck% vbundleCheck gToggleBundle xs+360 yp+50,Bundle Enabled 74 | Gui,2: Add, Button, w80 Default GPButtonOK xs+290 yp+30,&OK 75 | Gui,2: Add, Button, w80 xp+90 GPButtonCancel, &Cancel 76 | Gui,2: Show, , Texter Management 77 | GuiControl,2: Focus, Choice 78 | GuiControl,2: Disable, FullText 79 | Hotkey,IfWinActive, Texter Management 80 | Hotkey,!p,Preferences 81 | ;Hotkey,delete,Delete 82 | Hotkey,^s,PButtonSave 83 | Hotkey,IfWinActive 84 | Gosub,ListBundle 85 | return 86 | 87 | ListBundle: 88 | if A_GuiControl = BundleTabs 89 | GuiControlGet,CurrentBundle,2:,BundleTabs 90 | Gosub, DisableControls 91 | IniRead,bundleCheck,texter.ini,Bundles,%CurrentBundle% 92 | ActiveBundle = %CurrentBundle% 93 | GuiControl,2:,Choice,| 94 | Loop,bundles\*,2 95 | { 96 | Bundles = %Bundles%|%A_LoopFileName% 97 | thisBundle = %A_LoopFileName% 98 | Loop,bundles\%A_LoopFileName%\replacements\*.txt 99 | { 100 | thisReplacement:=Dehexify(A_LoopFileName) 101 | thisBundle = %thisBundle%%thisReplacement%| 102 | } 103 | ; StringReplace, thisBundle, thisBundle, .txt,,All 104 | StringReplace, thisBundle, thisBundle, %A_LoopFileName%,|, 105 | %A_LoopFileName% = %thisBundle% 106 | } 107 | ;if A_GuiControl = Tab 108 | ; GuiControl,,Choice,| 109 | ;else 110 | ; GuiControl,,Choice,%RString%|| 111 | GuiControl,2:,FullText, 112 | GuiControl,2:,EnterCbox,0 113 | GuiControl,2:,TabCbox,0 114 | GuiControl,2:,SpaceCbox,0 115 | GuiControl,2:,bundleCheck,%bundleCheck% 116 | if CurrentBundle = Default 117 | { 118 | Gosub,GetFileList 119 | CurrentBundle = %FileList% 120 | GuiControl,2:,Choice,%CurrentBundle% 121 | } 122 | else 123 | { 124 | StringTrimLeft,CurrentBundle,%CurrentBundle%,0 125 | GuiControl,2:,Choice,%CurrentBundle% 126 | } 127 | if MakeActive <> ; need to remove if deemed obsolete (probably yes) 128 | { 129 | StringReplace,CurrentBundle,CurrentBundle,|%MakeActive%|,|%MakeActive%|| 130 | GuiControl,2:,Choice,| 131 | GuiControl,2:,Choice,%CurrentBundle% 132 | ActiveChoice = %MakeActive% 133 | MakeActive = 134 | CurrentBundle = %ActiveBundle% 135 | GoSub, ShowString 136 | } 137 | return 138 | 139 | DisableControls: 140 | GuiControl, 2: Disable, FullText 141 | GuiControl, 2: Disable, EnterCbox 142 | GuiControl, 2: Disable, TabCbox 143 | GuiControl, 2: Disable, SpaceCbox 144 | GuiControl, 2: Disable, NoTrigCbox 145 | GuiControl, 2: Disable, SaveButton 146 | GuiControl, 2: Disable, TextOrScript 147 | return 148 | 149 | EnableControls: 150 | GuiControl, 2: Enable, FullText 151 | GuiControl, 2: Enable, EnterCbox 152 | GuiControl, 2: Enable, TabCbox 153 | GuiControl, 2: Enable, SpaceCbox 154 | GuiControl, 2: Enable, NoTrigCbox 155 | GuiControl, 2: Enable, SaveButton 156 | GuiControl, 2: Enable, TextOrScript 157 | return 158 | 159 | ToggleBundle: 160 | GuiControlGet,CurrentBundle,,BundleTabs 161 | GuiControlGet,bundleCheck,,bundleCheck 162 | IniWrite,%bundleCheck%,texter.ini,Bundles,%CurrentBundle% 163 | Gosub,BuildActive 164 | return 165 | 166 | ADD: 167 | GoSub,Newkey 168 | IfWinExist,Add new hotstring... 169 | { 170 | WinWaitClose,Add new hotstring...,, 171 | } 172 | GoSub,ListBundle 173 | StringReplace, CurrentBundle, CurrentBundle,|%RString%|,|%RString%|| 174 | GuiControl,,Choice,|%CurrentBundle% 175 | GoSub,ShowString 176 | return 177 | 178 | DELETE: 179 | Gui 2:+OwnDialogs 180 | If A_Gui = 2 ; gui 2 is the texter management gui 181 | { 182 | GuiControlGet,ActiveChoice,,Choice 183 | GuiControlGet,CurrentBundle,,BundleTabs 184 | } 185 | if A_Gui = 2 186 | { 187 | MsgBox,1,Confirm Delete,Are you sure you want to delete this hotstring: %ActiveChoice% 188 | } 189 | IfMsgBox, OK 190 | { 191 | DeleteHotstring(ActiveChoice, CurrentBundle) 192 | GoSub,ListBundle 193 | Gosub,BuildActive 194 | } 195 | return 196 | 197 | ShowString: 198 | if A_Gui = 2 199 | { 200 | GuiControlGet,ActiveChoice,,Choice 201 | GuiControlGet,CurrentBundle,,BundleTabs 202 | } 203 | Gosub, EnableControls 204 | GuiControl,2: Enable, FullText 205 | ActiveChoice:=Hexify(ActiveChoice) 206 | if CurrentBundle = Default 207 | ReadFrom = 208 | else 209 | ReadFrom = bundles\%CurrentBundle%\ 210 | 211 | FileRead,enter,%ReadFrom%bank\enter.csv 212 | FileRead,tab,%ReadFrom%bank\tab.csv 213 | FileRead,space,%ReadFrom%bank\space.csv 214 | FileRead,notrig,%ReadFrom%bank\notrig.csv 215 | if ActiveChoice in %enter% 216 | { 217 | GuiControl,2:,EnterCbox,1 218 | } 219 | else 220 | GuiControl,2:,EnterCbox,0 221 | if ActiveChoice in %tab% 222 | { 223 | GuiControl,2:,TabCbox,1 224 | } 225 | else 226 | GuiControl,2:,TabCbox,0 227 | if ActiveChoice in %space% 228 | { 229 | GuiControl,2:,SpaceCbox,1 230 | } 231 | else 232 | GuiControl,2:,SpaceCbox,0 233 | if ActiveChoice in %notrig% 234 | { 235 | GuiControl,2:,NoTrigCbox,1 236 | } 237 | else 238 | GuiControl,2:,NoTrigCbox,0 239 | FileRead, Text, %ReadFrom%replacements\%ActiveChoice%.txt 240 | IfInString,Text,::scr:: 241 | { 242 | GuiControl,2:,TextOrScript,|Text|Script|| 243 | StringReplace,Text,Text,::scr::,, 244 | IsScript:= true 245 | } 246 | else 247 | { 248 | GuiControl,2:,TextOrScript,|Text||Script 249 | IsScript:= false 250 | } 251 | GuiControl,2:,FullText,%Text% 252 | return 253 | 254 | PButtonSave: 255 | Gui,2: Submit, NoHide 256 | IsScript := (TextOrScript == "Script") 257 | 258 | If Choice <> 259 | { 260 | if (CurrentBundle != "") and (CurrentBundle != "Default") 261 | SaveToDir = Bundles\%CurrentBundle%\ 262 | else 263 | SaveToDir = 264 | PSaveSuccessful := SaveHotstring(Choice, FullText, IsScript, SaveToDir, SpaceCbox, TabCbox, EnterCbox, NoTrigCbox) 265 | } 266 | else 267 | { 268 | PSaveSuccessful = true 269 | } 270 | return 271 | 272 | 2GuiEscape: 273 | PButtonCancel: 274 | Gui,2: Destroy 275 | return 276 | 277 | PButtonOK: 278 | Gosub,PButtonSave 279 | if PSaveSuccessful 280 | { 281 | Gui,2: Submit 282 | Gui,2: Destroy 283 | } 284 | return 285 | -------------------------------------------------------------------------------- /includes/GUI/newkey_GUI.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | NEWKEY: 3 | Bundles= 4 | Loop,bundles\*,2 5 | { 6 | thisBundle = %A_LoopFileName% 7 | if (thisBundle != "Autocorrect") 8 | { 9 | Bundles = %Bundles%%A_LoopFileName%| 10 | StringReplace, thisBundle, thisBundle, .txt,,All 11 | StringReplace, thisBundle, thisBundle, %A_LoopFileName%,, 12 | %A_LoopFileName% = %thisBundle% 13 | } 14 | } 15 | if A_GuiControl = + ;;;; MAYBE CHANGE THIS TO IfWinExist,Texter Management 16 | { 17 | GuiControlGet,CurrentBundle,,BundleTabs 18 | StringReplace,Bundles,Bundles,%CurrentBundle%,$ 19 | StringSplit,Bundles,Bundles,$ 20 | ; MsgBox,%Bundles1% %Bundles2% 21 | ; msgbox %currentbundle% 22 | ; msgbox,%bundles2% 23 | Bundles = %Bundles1%%CurrentBundle%|%Bundles2% 24 | } 25 | else 26 | CurrentBundle = 27 | if (CurrentBundle != "") and (CurrentBundle != "Default") 28 | AddToDir = Bundles\%CurrentBundle%\ 29 | else 30 | AddToDir = 31 | Gui,1: Destroy 32 | IniRead,EnterBox,texter.ini,Triggers,Enter 33 | IniRead,TabBox,texter.ini,Triggers,Tab 34 | IniRead,SpaceBox,texter.ini,Triggers,Space 35 | IniRead,NoTrigBox,texter.ini,Triggers,NoTrig 36 | Gui,1: font, s12, Arial 37 | Gui,1: +owner2 +AlwaysOnTop -SysMenu +ToolWindow ;suppresses taskbar button, always on top, removes minimize/close 38 | Gui,1: Add, Text,x10 y20, Hotstring: 39 | Gui,1: Add, Edit, x13 y45 r1 W65 vRString, 40 | Gui,1: Add, Edit, x100 y45 r4 W395 vFullText, Enter your replacement text here... 41 | Gui,1: Add, Text,x115,Trigger: 42 | Gui,1: Add, Checkbox, gDisableChecks vEnterCbox yp x175 Checked%EnterBox%, Enter 43 | Gui,1: Add, Checkbox, gDisableChecks vTabCbox yp x242 Checked%TabBox%, Tab 44 | Gui,1: Add, Checkbox, gDisableChecks vSpaceCbox yp x305 Checked%SpaceBox%, Space 45 | Gui,1: Add, Checkbox, gDisableChecks vNoTrigCbox yp x388 Checked%NoTrigBox%, Instant 46 | Gui,1: font, s8, Arial 47 | Gui,1: Add, Button,w80 x320 default,&OK 48 | Gui,1: Add, Button,w80 xp+90 GButtonCancel,&Cancel 49 | Gui,1: font, s12, Arial 50 | Gui,1: Add,DropDownList,x100 y15 w100 vTextOrScript, Text||Script 51 | Gui,1: Add, Text,x315 y19, Bundle: 52 | Gui,1: Add,DropDownList,x370 y15 w125 vBundle,Default||%Bundles% 53 | Gui,1: Add,Picture,x0 y105,%TexterPNG% 54 | Gui 2:+Disabled 55 | Gui,1: Show, W500 H200,Add new hotstring... 56 | return 57 | 58 | GuiEscape: 59 | ButtonCancel: 60 | Gui 2:-Disabled 61 | Gui,1: Destroy 62 | return 63 | 64 | ButtonOK: 65 | Gui,1: Submit, NoHide 66 | Gui 1:+OwnDialogs 67 | hexRString:=hexify(RString) 68 | if (Bundle != "") and (Bundle != "Default") 69 | AddToDir = Bundles\%Bundle%\ 70 | IfExist, %A_ScriptDir%\%AddToDir%replacements\%hexRString%.txt 71 | { 72 | MsgBox,262144,Hotstring already exists, A replacement with the text %RString% already exists. Would you like to try again? 73 | return 74 | } 75 | IsScript := (TextOrScript == "Script") 76 | if SaveHotstring(RString, FullText, IsScript, AddToDir, SpaceCbox, TabCbox, EnterCbox, NoTrigCbox) 77 | { 78 | Gui 2:-Disabled 79 | Gui,1: Submit 80 | } 81 | Gosub,GetFileList 82 | return 83 | 84 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End Implementation and GUI for on-the-fly creation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 85 | -------------------------------------------------------------------------------- /includes/GUI/preferences_GUI.ahk: -------------------------------------------------------------------------------- 1 | PREFERENCES: 2 | Gui,3: Destroy 3 | Gui,3: +owner 4 | Gui,3: Add, Tab,x5 y5 w315 h280 vTabs,General|Print|Stats ;|Import|Export Add these later 5 | IniRead,otfhotkey,texter.ini,Hotkey,OntheFly 6 | Gui,3: Add,Text,x10 y40,On-the-Fly shortcut: 7 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsotfhotkey, %otfhotkey% 8 | Gui,3: Add,Text,x150 y40,Hotstring Management shortcut: 9 | IniRead,managehotkey,texter.ini,Hotkey,Management 10 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vsmanagehotkey, %managehotkey% 11 | Gui,3: Add,Text,x10 yp+25,Global disable shortcut: 12 | IniRead,disablehotkey,texter.ini,Hotkey,Disable 13 | Gui,3: Add,Hotkey,xp+10 yp+20 w100 vdisablehotkey,%disablehotkey% 14 | ;code optimization -- use mode value to set in initial radio values 15 | CompatMode := NOT MODE 16 | Gui,3: Add,Radio,x10 yp+30 vModeGroup Checked%CompatMode%,Compatibility mode (Default) 17 | Gui,3: Add,Radio,Checked%MODE%,Clipboard mode (Faster, but less compatible) 18 | IniRead,OnStartup,texter.ini,Settings,Startup 19 | Gui,3: Add,Checkbox, vStartup x20 yp+30 Checked%OnStartup%,Run Texter at start up 20 | IniRead,Update,texter.ini,Preferences,UpdateCheck 21 | Gui,3: Add,Checkbox, vUpdate x20 yp+20 Checked%Update%,Check for updates at launch? 22 | IniRead,AutoCorrect,texter.ini,Preferences,AutoCorrect 23 | Gui,3: Add,Checkbox, vAutoCorrect x20 yp+20 gToggle Checked%AutoCorrect%,Enable Universal Spelling AutoCorrect? 24 | IniRead,ExSound,texter.ini,Preferences,ExSound 25 | Gui,3: Add,Checkbox, vExSound x20 yp+20 gToggle Checked%ExSound%,Play sound when replacement triggered? 26 | IniRead,Synergy,texter.ini,Preferences,Synergy 27 | Gui,3: Add,Checkbox, vSynergy x20 yp+20 gToggle Checked%Synergy%,Make Texter compatible across computers with Synergy? 28 | ;Gui,3: Add,Button,x150 y200 w75 GSETTINGSOK Default,&OK 29 | Gui,3: Add,Button,x165 y296 w75 GSETTINGSOK Default,&OK 30 | Gui,3: Add,Button,xP+80 yp w75 GSETTINGSCANCEL,&Cancel 31 | Gui,3: Tab,2 32 | Gui,3: Add,Button,w150 h150 gPrintableList,Create Printable Texter Cheatsheet 33 | Gui,3: Add,Text,xp+160 y50 w125 Wrap,Click the big button to export a printable cheatsheet of all your Texter hotstrings, replacements, and triggers. 34 | Gui,3: Add,Button,x165 y296 w75 GSETTINGSOK Default,&OK 35 | Gui,3: Add,Button,xp+80 yp w75 GSETTINGSCANCEL,&Cancel 36 | Gui,3: Tab,3 37 | Gui,3: Add,Text,x10 y40,Your Texter stats: 38 | IniRead,expanded,texter.ini,Stats,Expanded 39 | if expanded = ERROR 40 | { 41 | expanded = 0 42 | } 43 | Gui,3: Add,Text,x25 y60,Snippets expanded: %expanded% 44 | IniRead,chars_saved,texter.ini,Stats,Characters 45 | if chars_saved = ERROR 46 | { 47 | chars_saved = 0 48 | } 49 | Gui,3: Add,Text,x25 y80,Characters saved: %chars_saved% 50 | SetFormat,FLOAT,0.2 51 | time_saved := chars_saved/24000 52 | Gui,3: Add,Text,x25 y100,Hours saved: %time_saved% (assuming 400 chars/minute) 53 | Gui,3: Add,Button,x165 y296 w75 GSETTINGSOK Default,&OK 54 | Gui,3: Add,Button,xp+80 yp w75 GSETTINGSCANCEL,&Cancel 55 | Gui 2:+Disabled 56 | Gui,3: Show,,Texter Preferences 57 | GuiControl,3: Focus, Tabs 58 | Disable=1 59 | WinWaitClose, Texter Preferences 60 | Disable= 61 | Return 62 | 63 | SETTINGSOK: 64 | Gui,3: Submit, NoHide 65 | If (sotfhotkey != otfhotkey) 66 | { 67 | if otfhotkey <> ; disable old hotkey 68 | { 69 | Hotkey,IfWinNotActive,Texter Preferences 70 | Hotkey, %otfhotkey%,Off 71 | Hotkey,IfWinActive 72 | } 73 | otfhotkey:=sotfhotkey 74 | If otfhotkey<> 75 | { 76 | Hotkey,IfWinNotActive,Texter Preferences 77 | Hotkey,%otfhotkey%,Newkey 78 | HotKey,%otfhotkey%,On 79 | Hotkey,IfWinActive 80 | } 81 | IniWrite,%otfhotkey%,texter.ini,Hotkey,OntheFly 82 | } 83 | 84 | If (smanagehotkey != managehotkey) 85 | { 86 | managehotkey:=smanagehotkey 87 | If managehotkey<> 88 | { 89 | Hotkey,IfWinNotActive,Texter Preferences 90 | Hotkey,%managehotkey%,Manage 91 | HotKey,%managehotkey%,On 92 | Hotkey,IfWinActive 93 | } 94 | IniWrite,%managehotkey%,texter.ini,Hotkey,Management 95 | } 96 | IniWrite,%disablehotkey%,texter.ini,Hotkey,Disable 97 | if disablehotkey <> 98 | { 99 | Hotkey,IfWinNotActive,Texter Preferences 100 | Hotkey,%disablehotkey%,DISABLE 101 | Hotkey,IfWinActive 102 | } 103 | ;code optimization -- calculate MODE from ModeGroup 104 | MODE := ModeGroup - 1 105 | IniWrite,%MODE%,texter.ini,Settings,Mode 106 | IniWrite,%Update%,texter.ini,Preferences,UpdateCheck 107 | If Startup = 1 108 | { 109 | IfNotExist %A_StartMenu%\Programs\Startup\Texter.lnk 110 | ;Get icon for shortcut link: 111 | ;1st from compiled EXE 112 | if %A_IsCompiled% 113 | { 114 | IconLocation=%A_ScriptFullPath% 115 | } 116 | ;2nd from icon in resources folder 117 | else IfExist %TexterICO% 118 | { 119 | IconLocation=%TexterICO% 120 | } 121 | ;3rd from the AutoHotkey application itself 122 | else 123 | { 124 | IconLocation=%A_AhkPath% 125 | } 126 | ;use %A_ScriptFullPath% instead of texter.exe 127 | ;to allow compatibility with source version 128 | FileCreateShortcut,%A_ScriptFullPath%,%A_StartMenu%\Programs\Startup\Texter.lnk,%A_ScriptDir%,,Text replacement system tray application,%IconLocation% 129 | } 130 | else 131 | { 132 | IfExist %A_StartMenu%\Programs\Startup\Texter.lnk 133 | { 134 | FileDelete %A_StartMenu%\Programs\Startup\Texter.lnk 135 | } 136 | } 137 | IniWrite,%Startup%,texter.ini,Settings,Startup 138 | 3GuiClose: 139 | 3GuiEscape: 140 | SETTINGSCANCEL: 141 | Gui 2:-Disabled 142 | Gui,3: Destroy 143 | 144 | Return 145 | 146 | TOGGLE: 147 | GuiControlGet,ToggleValue,,%A_GuiControl% 148 | IniWrite,%ToggleValue%,texter.ini,Preferences,%A_GuiControl% 149 | return -------------------------------------------------------------------------------- /includes/GUI/textprompt_GUI.ahk: -------------------------------------------------------------------------------- 1 | textPrompt(thisText) { 2 | Gui,7: +AlwaysOnTop -SysMenu +ToolWindow 3 | Gui,7: Add,Text,x5 y5, Enter the text you want to insert: 4 | Gui,7: Add,Edit,x20 y25 r1 vpromptText 5 | Gui,7: Add,Text,x5 y50,Your text will be replace the `%p variable: 6 | Gui,7: Add,Text,w300 Wrap x20 y70,%thisText% 7 | Gui,7: Show,auto,Enter desired text 8 | Hotkey,IfWinActive,Enter desired text 9 | Hotkey,Enter,SubmitPrompt 10 | Hotkey,NumpadEnter,SubmitPrompt 11 | ;Hotkey,Space, 12 | Hotkey,Escape,ExitPrompt 13 | WinWaitClose,Enter desired text 14 | } 15 | return 16 | 17 | SubmitPrompt: 18 | Gui, 7: Submit 19 | Gui, 7: Destroy 20 | escapePrompt = 21 | StringReplace,ReplacementText,ReplacementText,`%p,%promptText% 22 | return 23 | 24 | ExitPrompt: 25 | Gui, 7: Destroy 26 | escapePrompt = 1 27 | return -------------------------------------------------------------------------------- /includes/GUI/traymenu_GUI.ahk: -------------------------------------------------------------------------------- 1 | TRAYMENU: 2 | Menu,TRAY,NoStandard 3 | Menu,TRAY,DeleteAll 4 | Menu,TRAY,Add,&Manage hotstrings,MANAGE 5 | Menu,TRAY,Add,&Create new hotstring,NEWKEY 6 | Menu,TRAY,Add 7 | Menu,TRAY,Add,P&references...,PREFERENCES 8 | Menu,TRAY,Add,&Import bundle,IMPORT 9 | Menu,TRAY,Add,&Help,HELP 10 | Menu,TRAY,Add 11 | Menu,TRAY,Add,&About...,ABOUT 12 | Menu,TRAY,Add,&Disable,DISABLE 13 | if disable = 1 14 | Menu,Tray,Check,&Disable 15 | Menu,TRAY,Add,E&xit,EXIT 16 | Menu,TRAY,Default,&Manage hotstrings 17 | Menu,Tray,Tip,Texter 18 | Menu,TRAY,Icon,resources\texter.ico 19 | Return -------------------------------------------------------------------------------- /includes/functions/InsSpecKeys.ahk: -------------------------------------------------------------------------------- 1 | #IfWinActive, ahk_class AutoHotkeyGUI 2 | Ins & LWin:: 3 | Ins & Rwin:: 4 | SendRaw,# 5 | return 6 | 7 | Ins & Shift::SendRaw,+ 8 | Ins & Ctrl::SendRaw,^ 9 | Ins & Alt::SendRaw,! 10 | Ins & i::SendRaw,{Ins} 11 | 12 | Ins & F1:: 13 | Ins & F2:: 14 | Ins & F3:: 15 | Ins & F4:: 16 | Ins & F5:: 17 | Ins & F6:: 18 | Ins & F7:: 19 | Ins & F8:: 20 | Ins & F9:: 21 | Ins & F10:: 22 | Ins & F11:: 23 | Ins & F12:: 24 | Ins & !:: 25 | Ins & #:: 26 | Ins & +:: 27 | Ins & ^:: 28 | Ins & {:: 29 | Ins & }:: 30 | Ins & Enter:: 31 | Ins & Esc:: 32 | Ins & Space:: 33 | Ins & Tab:: 34 | Ins & BS:: 35 | Ins & Del:: 36 | Ins & Up:: 37 | Ins & Down:: 38 | Ins & Left:: 39 | Ins & Right:: 40 | Ins & Home:: 41 | Ins & End:: 42 | Ins & PgUp:: 43 | Ins & PgDn:: 44 | Ins & CapsLock:: 45 | Ins & ScrollLock:: 46 | Ins & NumLock:: 47 | Ins & AppsKey:: 48 | Ins & PrintScreen:: 49 | Ins & Pause:: 50 | Ins & WheelDown:: 51 | Ins & WheelUp:: 52 | Ins & LButton:: 53 | Ins & RButton:: 54 | InsText:="Ins & " 55 | StringReplace,SpecKey,A_ThisHotkey,%InsText%,, 56 | SendRaw,{%SpecKey%} 57 | return 58 | #IfWinActive -------------------------------------------------------------------------------- /includes/functions/InstallAutocorrect.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/includes/functions/InstallAutocorrect.ahk -------------------------------------------------------------------------------- /includes/functions/MonitorWindows.ahk: -------------------------------------------------------------------------------- 1 | MonitorWindows: 2 | ;WinGet CurrWinID, ID, A 3 | WinGetClass CurrWinClass, A 4 | ;Tooltip, CurrWinID= %CurrWinID% ~ PrevWinID= %PrevWinID% 5 | ;if (CurrWinID <> PrevWinID) 6 | ;{ 7 | ; PrevWinID = %CurrWinID% 8 | ; PossibleMatch= 9 | ;} 10 | return 11 | -------------------------------------------------------------------------------- /includes/functions/addtobank.ahk: -------------------------------------------------------------------------------- 1 | AddToBank(HotString, Bundle, Trigger) 2 | { 3 | ;HotString:=Dehexify(HotString) 4 | BankFile = %Bundle%bank\%trigger%.csv 5 | IfNotExist %BankFile% 6 | { 7 | FileAppend,, %BankFile% 8 | } 9 | FileRead, Bank, %BankFile% 10 | if HotString not in %Bank% 11 | { 12 | FileAppend,%HotString%`,, %BankFile% 13 | FileRead, Bank, %BankFile% 14 | } 15 | } -------------------------------------------------------------------------------- /includes/functions/autoclose.ahk: -------------------------------------------------------------------------------- 1 | ;AUTOCLOSE: 2 | ;:*?B0:(::){Left} 3 | ;:*?B0:[::]{Left} 4 | ;:*?B0:{::{}}{Left} 5 | ;return 6 | -------------------------------------------------------------------------------- /includes/functions/autocorrect.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/includes/functions/autocorrect.ahk -------------------------------------------------------------------------------- /includes/functions/buildactive.ahk: -------------------------------------------------------------------------------- 1 | BuildActive: 2 | activeBundles = 3 | Loop,bundles\*,2 4 | { 5 | IniRead,activeCheck,texter.ini,Bundles,%A_LoopFileName% 6 | if activeCheck = 1 7 | activeBundles = %activeBundles%%A_LoopFileName%, 8 | } 9 | IniRead,activeCheck,texter.ini,Bundles,Default 10 | if activeCheck = 1 11 | activeBundles = %activeBundles%Default 12 | if skipfirst <> 13 | { 14 | FileDelete,Active\replacements\* 15 | FileDelete,Active\bank\* 16 | Loop,Parse,activeBundles,CSV 17 | { 18 | if A_LoopField = Default 19 | { 20 | FileCopy,replacements\*.txt,Active\replacements 21 | FileRead,tab,bank\tab.csv 22 | FileAppend,%tab%,Active\bank\tab.csv 23 | FileRead,space,bank\space.csv 24 | FileAppend,%space%,Active\bank\space.csv 25 | FileRead,enter,bank\enter.csv 26 | FileAppend,%enter%,Active\bank\enter.csv 27 | FileRead,notrig,bank\notrig.csv 28 | FileAppend,%notrig%,Active\bank\notrig.csv 29 | } 30 | ; else if A_LoopField = Autocorrect 31 | ; { 32 | ; 33 | ; } 34 | else 35 | { 36 | FileCopy,Bundles\%A_LoopField%\replacements\*.txt,active\replacements 37 | FileRead,tab,Bundles\%A_LoopField%\bank\tab.csv 38 | FileAppend,%tab%,active\bank\tab.csv 39 | FileRead,space,Bundles\%A_LoopField%\bank\space.csv 40 | FileAppend,%space%,active\bank\space.csv 41 | FileRead,enter,Bundles\%A_LoopField%\bank\enter.csv 42 | FileAppend,%enter%,active\bank\enter.csv 43 | FileRead,notrig,Bundles\%A_LoopField%\bank\notrig.csv 44 | FileAppend,%notrig%,active\bank\notrig.csv 45 | } 46 | ; IfExist active\replacements\wc.txt 47 | ; MsgBox,%A_LoopFileName% put me here 48 | } 49 | } 50 | skipfirst=1 51 | FileRead, EnterKeys, %A_WorkingDir%\Active\bank\enter.csv 52 | FileRead, TabKeys, %A_WorkingDir%\Active\bank\tab.csv 53 | FileRead, SpaceKeys, %A_WorkingDir%\Active\bank\space.csv 54 | FileRead, NoTrigKeys, %A_WorkingDir%\Active\bank\notrig.csv 55 | ActiveList = 56 | HotStrings= | ; added this variable for Dustin's new trigger method... need to sometime check and see if ActiveList is necessary 57 | Loop, Active\replacements\*.txt 58 | { 59 | ActiveList = %ActiveList%%A_LoopFileName%| 60 | This_HotString := Dehexify(A_LoopFileName) 61 | HotStrings = %HotStrings%%This_HotString%| 62 | } 63 | ;Loop, Active\Autocorrect\replacements\*.txt 64 | ;{ 65 | ;ActiveList = %ActiveList%%A_LoopFileName%| 66 | ; This_HotString := Dehexify(A_LoopFileName) 67 | ; ACHotStrings = %ACHotStrings%%This_HotString%| 68 | ;} 69 | ;FileAppend, %ACHotstrings%,pipelist.txt 70 | if Autocorrect = 1 71 | { ; append autocorrect list to hotstrings 72 | FileRead, AutocorrectHotstrings,%A_WorkingDir%\Active\Autocorrect\pipelist.txt 73 | HotStrings = %HotStrings%%AutocorrectHotstrings% 74 | } 75 | StringReplace, ActiveList, ActiveList, .txt,,All 76 | return -------------------------------------------------------------------------------- /includes/functions/bundles.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/includes/functions/bundles.ahk -------------------------------------------------------------------------------- /includes/functions/delfrombank.ahk: -------------------------------------------------------------------------------- 1 | DelFromBank(HotString, Bundle, Trigger) 2 | { 3 | BankFile = %Bundle%bank\%trigger%.csv 4 | FileRead, Bank, %BankFile% 5 | ;HotString:=Dehexify(HotString) 6 | if HotString in %Bank% 7 | { 8 | StringReplace, Bank, Bank, %HotString%`,,,All 9 | FileDelete, %BankFile% 10 | FileAppend,%Bank%, %BankFile% 11 | } 12 | } -------------------------------------------------------------------------------- /includes/functions/disable.ahk: -------------------------------------------------------------------------------- 1 | DISABLE: 2 | IniRead,disable,texter.ini,Settings,Disable 3 | if Disable = 0 4 | { 5 | IniWrite,1,texter.ini,Settings,Disable 6 | ; EnableTriggers(false) 7 | Menu,Tray,Check,&Disable 8 | Disable = 1 9 | Send,{%SpecialKey%} 10 | } 11 | else 12 | { 13 | IniWrite,0,texter.ini,Settings,Disable 14 | ; EnableTriggers(true) 15 | Menu,Tray,Uncheck,&Disable 16 | Disable = 0 17 | } 18 | return -------------------------------------------------------------------------------- /includes/functions/enabletriggers.ahk: -------------------------------------------------------------------------------- 1 | EnableTriggers(doEnable) 2 | { 3 | ;global keys 4 | ; StringReplace,tempKeys,keys,`}`,`{,`n,All 5 | ; Loop,Parse,TempKeys,`n,`{`} 6 | ; { 7 | ; if (doEnable) 8 | ; { 9 | ; Hotkey,IfWinNotActive,Enter desired text 10 | ; Hotkey,$%A_LoopField%,HOTKEYS 11 | ; Hotkey,$%A_LoopField%,On 12 | ; Hotkey,IfWinActive 13 | ; } 14 | ; else 15 | ; { 16 | ; Hotkey,IfWinNotActive,Enter desired text 17 | ; Hotkey,$%A_LoopField%,Off 18 | ; Hotkey,IfWinActive 19 | ; } 20 | ; } 21 | } 22 | -------------------------------------------------------------------------------- /includes/functions/getfilelist.ahk: -------------------------------------------------------------------------------- 1 | GetFileList: 2 | FileList = 3 | Loop, %A_ScriptDir%\replacements\*.txt 4 | { 5 | if A_Index = 1 6 | { 7 | thisFile:=Dehexify(A_LoopFileName) 8 | FileList = |%thisFile%| 9 | ;MakeActive = %thisFile% 10 | } 11 | else 12 | { 13 | thisFile:=Dehexify(A_LoopFileName) 14 | FileList = %FileList%%thisFile%| 15 | } 16 | } 17 | CurrentBundle = Default 18 | StringReplace, FileList, FileList, .txt,,All 19 | return -------------------------------------------------------------------------------- /includes/functions/getvalfromini.ahk: -------------------------------------------------------------------------------- 1 | ;; method written by Dustin Luck for writing to ini 2 | GetValFromIni(section, key, default) 3 | { 4 | IniRead,IniVal,texter.ini,%section%,%key% 5 | if IniVal = ERROR 6 | { 7 | IniWrite,%default%,texter.ini,%section%,%key% 8 | IniVal := default 9 | } 10 | return IniVal 11 | } 12 | -------------------------------------------------------------------------------- /includes/functions/hexall.ahk: -------------------------------------------------------------------------------- 1 | HexAll: 2 | ;MsgBox,Hexing time! 3 | FileCopyDir,replacements,resources\backup\replacements 4 | FileCopyDir,bank,resources\backup\bank 5 | Loop, %A_ScriptDir%\replacements\*.txt 6 | { 7 | StringReplace, thisFile, A_LoopFileName, .txt,,All 8 | thisFile:=Hexify(thisFile) 9 | ;MsgBox,% thisFile 10 | FileMove,%A_ScriptDir%\replacements\%A_LoopFileName%,%A_ScriptDir%\replacements\%thisFile%.txt 11 | } 12 | Loop, %A_ScriptDir%\bank\*.csv 13 | { 14 | FileRead,thisBank,%A_ScriptDir%\bank\%A_LoopFileName% 15 | Loop,Parse,thisBank,CSV 16 | { 17 | thisString:=Hexify(A_LoopField) 18 | 19 | hexBank = %hexBank%%thisString%, 20 | } 21 | FileDelete,%A_ScriptDir%\bank\%A_LoopFileName% 22 | FileAppend,%hexBank%,%A_ScriptDir%\bank\%A_LoopFileName% 23 | } 24 | ;TODO: Also hexify .csv files 25 | 26 | IniWrite,1,texter.ini,Settings,Hexified 27 | IniWrite,1,texter.ini,Bundles,Default 28 | return 29 | 30 | -------------------------------------------------------------------------------- /includes/functions/hexify.ahk: -------------------------------------------------------------------------------- 1 | Hexify(x) ;Stolen from Autoclip/Laszlo 2 | { 3 | StringLen,len,x 4 | format=%A_FormatInteger% 5 | SetFormat,Integer,Hex 6 | hex= 7 | Loop,%len% 8 | { 9 | Transform,y,Asc,%x% 10 | StringTrimLeft,y,y,2 11 | hex=%hex%%y% 12 | StringTrimLeft,x,x,1 13 | } 14 | SetFormat,Integer,%format% 15 | Return,hex 16 | } 17 | 18 | DeHexify(x) 19 | { 20 | StringLen,len,x 21 | ;len:=(len-4)/2 22 | string= 23 | Loop,%len% 24 | { 25 | StringLeft,hex,x,2 26 | hex=0x%hex% 27 | Transform,y,Chr,%hex% 28 | string=%string%%y% 29 | StringTrimLeft,x,x,2 30 | } 31 | Return,string 32 | } 33 | -------------------------------------------------------------------------------- /includes/functions/printablelist.ahk: -------------------------------------------------------------------------------- 1 | PrintableList: 2 | alt := 0 3 | List = Texter Hotstrings and Replacement Text Cheatsheet

Texter Hostrings and Replacement Text Cheatsheet

Default

Hotstring

Replacement Text

Trigger(s)

4 | Loop, replacements\*.txt 5 | { 6 | alt := 1 - alt 7 | trig = 8 | hs = %A_LoopFileName% 9 | StringReplace, hs, hs, .txt 10 | FileRead, rp, replacements\%hs%.txt 11 | FileRead, entertrig, bank\enter.csv 12 | FileRead, tabtrig, bank\tab.csv 13 | FileRead, spacetrig, bank\space.csv 14 | FileRead, notrig, bank\notrig.csv 15 | If hs in %entertrig% 16 | trig = Enter 17 | If hs in %tabtrig% 18 | trig = %trig% Tab 19 | If hs in %spacetrig% 20 | trig = %trig% Space 21 | If hs in %notrig% 22 | trig = %trig% Instant 23 | StringReplace, rp, rp, <,<,All 24 | StringReplace, rp, rp, >,>,All 25 | hs := DeHexify(hs) 26 | List = %List%
%hs%%rp%%trig%

27 | 28 | } 29 | Loop,bundles\*,2 30 | { 31 | thisBundle = %A_LoopFileName% 32 | List = %List%


%thisBundle%

Hotstring

Replacement Text

Trigger(s)

33 | Loop,bundles\%A_LoopFileName%\replacements\*.txt 34 | { 35 | trig = 36 | hs = %A_LoopFileName% 37 | StringReplace, hs, hs, .txt 38 | FileRead, rp, bundles\%thisBundle%\replacements\%hs%.txt 39 | FileRead, entertrig, bundles\%thisBundle%\bank\enter.csv 40 | FileRead, tabtrig, bundles\%thisBundle%\bank\tab.csv 41 | FileRead, spacetrig, bundles\%thisBundle%\bank\space.csv 42 | FileRead, notrig, bundles\%thisBundle%\bank\notrig.csv 43 | If hs in %entertrig% 44 | trig = Enter 45 | If hs in %tabtrig% 46 | trig = %trig% Tab 47 | If hs in %spacetrig% 48 | trig = %trig% Space 49 | If hs in %notrig% 50 | trig = %trig% Instant 51 | StringReplace, rp, rp, <,<,All 52 | StringReplace, rp, rp, >,>,All 53 | hs := DeHexify(hs) 54 | List = %List%
%hs%%rp%%trig%

55 | } 56 | StringReplace, thisBundle, thisBundle, .txt,,All 57 | StringReplace, thisBundle, thisBundle, %A_LoopFileName%,, 58 | %A_LoopFileName% = %thisBundle% 59 | } 60 | List = %List% 61 | IfExist resources\Texter Replacement Guide.html 62 | FileDelete,resources\Texter Replacement Guide.html 63 | FileAppend,%List%, resources\Texter Replacement Guide.html 64 | Run,resources\Texter Replacement Guide.html 65 | return 66 | -------------------------------------------------------------------------------- /includes/functions/renameHotstring.ahk: -------------------------------------------------------------------------------- 1 | RENAME: 2 | Gui,9: Submit 3 | Gui,9: Destroy 4 | if ActiveChoice in %enter% 5 | { 6 | EnterCbox := true 7 | } 8 | else 9 | EnterCbox := false 10 | if ActiveChoice in %tab% 11 | { 12 | TabCbox:=true 13 | } 14 | else 15 | TabCbox:= false 16 | if ActiveChoice in %space% 17 | { 18 | SpaceCbox:= true 19 | } 20 | else 21 | SpaceCbox:= false 22 | if ActiveChoice in %notrig% 23 | { 24 | NoTrigCbox:= true 25 | } 26 | else 27 | NoTrigCbox:= false 28 | if (CurrentBundle != "") and (CurrentBundle != "Default") 29 | { 30 | AddToDir = Bundles\%CurrentBundle%\ 31 | } 32 | else 33 | { 34 | AddToDir= 35 | } 36 | if NewName = %editThis% 37 | { 38 | return 39 | } 40 | else if SaveHotstring(NewName, Text, IsScript, AddToDir, SpaceCbox, TabCbox, EnterCbox, NoTrigCbox) 41 | { 42 | DeleteHotstring(editThis, CurrentBundle) 43 | MakeActive = %NewName% 44 | GoSub,ListBundle 45 | } 46 | return 47 | 48 | 9GuiEscape: 49 | Gui,9: Destroy 50 | return -------------------------------------------------------------------------------- /includes/functions/resources.ahk: -------------------------------------------------------------------------------- 1 | RESOURCES: 2 | ;code optimization -- removed IfNotExist tests 3 | ;redundant when final arg to FileInstall is 0 4 | IfNotExist bank 5 | FileCreateDir, bank 6 | IfNotExist replacements 7 | FileCreateDir, replacements 8 | IfNotExist bundles 9 | FileCreateDir, bundles 10 | IfNotExist resources 11 | FileCreateDir, resources 12 | FileInstall,resources\texter.ico,%TexterICO%,1 13 | FileInstall,resources\replace.wav,%ReplaceWAV%,0 14 | FileInstall,resources\texter.png,%TexterPNG%,1 15 | FileInstall,resources\style.css,%StyleCSS%,0 16 | FileInstall,resources\throbber.gif,%Throbber%,1 17 | 18 | IfNotExist Active 19 | { 20 | FileCreateDir, Active 21 | FileCreateDir, Active\replacements 22 | FileCreateDir, Active\bank 23 | } 24 | IfNotExist Active\Autocorrect 25 | { 26 | FileCreateDir, Active\Autocorrect 27 | FileCreateDir, Active\Autocorrect\replacements 28 | FileInstall,resources\autocorrect.txt,resources\autocorrect.txt,1 29 | ;FileInstall,Active\Autocorrect\pipelist.txt,Active\Autocorrect\pipelist.txt,1 30 | ;FileInstall,Active\Autocorrect\autocorrect.csv,Active\Autocorrect\autocorrect.csv,1 31 | Gosub,InstallAutocorrect 32 | } 33 | return 34 | -------------------------------------------------------------------------------- /includes/functions/savehotstring.ahk: -------------------------------------------------------------------------------- 1 | SaveHotstring(HotString, Replacement, IsScript, Bundle, SpaceIsTrigger, TabIsTrigger, EnterIsTrigger, NoTrigger) 2 | { 3 | global EnterCSV 4 | global TabCSV 5 | global SpaceCSV 6 | global NoTrigCSV 7 | global EnterKeys 8 | global TabKeys 9 | global SpaceKeys 10 | global NoTrigKeys 11 | HotString:=Hexify(HotString) 12 | successful := false 13 | if (!EnterIsTrigger AND !TabIsTrigger AND !SpaceIsTrigger AND !NoTrigger) 14 | { 15 | MsgBox,262144,Choose a trigger,You need to choose a trigger method in order to save a hotstring replacement. 16 | } 17 | else if (HotString <> "" AND Replacement <> "") 18 | { 19 | successful := true 20 | if IsScript 21 | { 22 | Replacement = ::scr::%Replacement% 23 | } 24 | 25 | IniWrite,%SpaceIsTrigger%,texter.ini,Triggers,Space 26 | IniWrite,%TabIsTrigger%,texter.ini,Triggers,Tab 27 | IniWrite,%EnterIsTrigger%,texter.ini,Triggers,Enter 28 | IniWrite,%NoTrigger%,texter.ini,Triggers,NoTrig 29 | 30 | FileDelete, %A_ScriptDir%\%Bundle%replacements\%HotString%.txt 31 | FileAppend,%Replacement%,%A_ScriptDir%\%Bundle%replacements\%HotString%.txt 32 | 33 | if EnterIsTrigger 34 | { 35 | AddToBank(HotString, Bundle, "enter") 36 | } 37 | else 38 | { 39 | DelFromBank(HotString, Bundle, "enter") 40 | } 41 | if TabIsTrigger 42 | { 43 | AddToBank(HotString, Bundle, "tab") 44 | } 45 | else 46 | { 47 | DelFromBank(HotString, Bundle, "tab") 48 | } 49 | if SpaceIsTrigger 50 | { 51 | AddToBank(HotString, Bundle, "space") 52 | } 53 | else 54 | { 55 | DelFromBank(HotString, Bundle, "space") 56 | } 57 | if NoTrigger 58 | { 59 | AddToBank(HotString, Bundle, "notrig") 60 | } 61 | else 62 | { 63 | DelFromBank(HotString, Bundle, "notrig") 64 | } 65 | } 66 | GoSub,BuildActive 67 | return successful 68 | } 69 | 70 | DeleteHotstring(Hotstring, Bundle) 71 | { 72 | Hotstring:=Hexify(Hotstring) 73 | if (Bundle != "") and (Bundle != "Default") 74 | RemoveFromDir = Bundles\%Bundle%\ 75 | else 76 | RemoveFromDir = 77 | FileDelete,%A_ScriptDir%\%RemoveFromDir%replacements\%Hotstring%.txt 78 | DelFromBank(Hotstring, RemoveFromDir, "enter") 79 | DelFromBank(Hotstring, RemoveFromDir, "tab") 80 | DelFromBank(Hotstring, RemoveFromDir, "space") 81 | DelFromBank(Hotstring, RemoveFromDir, "notrig") 82 | GuiControl,2:,Choice,|%Bundle% 83 | GuiControl,2:,FullText, 84 | GuiControl,2:,EnterCbox,0 85 | GuiControl,2:,TabCbox,0 86 | GuiControl,2:,SpaceCbox,0 87 | Gosub, BuildActive 88 | return 89 | } -------------------------------------------------------------------------------- /includes/functions/updatecheck.ahk: -------------------------------------------------------------------------------- 1 | UpdateCheck: ;;;;;;; Update the version number on each new release ;;;;;;;;;;;;; 2 | IfNotExist texter.ini 3 | { 4 | MsgBox,4,Check for Updates?,Would you like to automatically check for updates when on startup? 5 | IfMsgBox,Yes 6 | updatereply = 1 7 | else 8 | updatereply = 0 9 | } 10 | update := GetValFromIni("Preferences","UpdateCheck",updatereply) 11 | IniWrite,%Version%,texter.ini,Preferences,Version 12 | if (update = 1) 13 | SetTimer,RunUpdateCheck,10000 14 | return 15 | 16 | RunUpdateCheck: 17 | update("texter") 18 | return 19 | 20 | update(program) { 21 | SetTimer, RunUpdateCheck, Off 22 | UrlDownloadToFile,http://svn.adampash.com/%program%/CurrentVersion.txt,VersionCheck.txt 23 | if ErrorLevel = 0 24 | { 25 | FileReadLine, Latest, VersionCheck.txt,1 26 | IniRead,Current,%program%.ini,Preferences,Version 27 | ;MsgBox,Latest: %Latest% `n Current: %Current% 28 | if (Latest > Current) 29 | { 30 | MsgBox,4,A new version of %program% is available!,Would you like to visit the %program% homepage and download the latest version? 31 | IfMsgBox,Yes 32 | Goto,Homepage 33 | } 34 | FileDelete,VersionCheck.txt ;; delete version check 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /includes/functions/urls.ahk: -------------------------------------------------------------------------------- 1 | Homepage: 2 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php 3 | return 4 | 5 | BasicUse: 6 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#basic 7 | return 8 | 9 | Scripting: 10 | Run http://lifehacker.com/software//lifehacker-code-texter-windows-238306.php#advanced 11 | return -------------------------------------------------------------------------------- /printable.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,Force 2 | #NoEnv 3 | SetWorkingDir, "%A_ScriptDir%" 4 | FileRead, EnterKeys, %A_WorkingDir%\bank\enter.csv 5 | FileRead, TabKeys, %A_WorkingDir%\bank\tab.csv 6 | FileRead, SpaceKeys, %A_WorkingDir%\bank\space.csv 7 | Gosub,PrintableList 8 | return 9 | 10 | 11 | 12 | PrintableList: 13 | FileDelete,%A_WorkingDir%\resources\Texter Replacement Guide.html 14 | MsgBox,Delete %A_WorkingDir%\resources\Texter Replacement Guide.html 15 | List = Texter Hotstrings and Replacement Text Cheatsheet

Texter Hostrings and Replacement Text Cheatsheet

16 | Loop, %A_WorkingDir%\replacements\*.txt 17 | { 18 | trig = 19 | hs = %A_LoopFileName% 20 | StringReplace, hs, hs, .txt 21 | FileRead, rp, %A_WorkingDir%\replacements\%hs%.txt 22 | If hs in %EnterKeys% 23 | trig = Enter 24 | If hs in %TabKeys% 25 | trig = %trig% Tab 26 | If hs in %SpaceKeys% 27 | trig = %trig% Space 28 | StringReplace, rp, rp, <,<,All 29 | StringReplace, rp, rp, >,>,All 30 | List = %List% 31 | 32 | } 33 | List = %List%
HotstringReplacement TextTrigger(s)
%hs%%rp%%trig%
34 | FileAppend,%List%, %A_WorkingDir%\resources\Texter Replacement Guide.html 35 | MsgBox,Append %A_WorkingDir%\resources\Texter Replacement Guide.html 36 | Run,%A_WorkingDir%\resources\Texter Replacement Guide.html 37 | return -------------------------------------------------------------------------------- /resources/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/Thumbs.db -------------------------------------------------------------------------------- /resources/autocorrect.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/autocorrect.txt -------------------------------------------------------------------------------- /resources/oldreplace.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/oldreplace.wav -------------------------------------------------------------------------------- /resources/replace.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/replace.wav -------------------------------------------------------------------------------- /resources/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin:0; 3 | padding:0; 4 | } 5 | 6 | body { 7 | margin:0; 8 | padding:30px; 9 | width:100%; 10 | background:#F8FAF0; 11 | font-family:"Lucida Grande",Tahoma,Verdana,times,serif; 12 | color:#252525; 13 | } 14 | 15 | #container { 16 | position:relative; 17 | width:100% 18 | } 19 | 20 | div { 21 | margin-left:15px; 22 | } 23 | 24 | h3 { 25 | text-align:center; 26 | } 27 | 28 | .row1 { 29 | x background:blue; 30 | x padding:10px 0 10px; 31 | } 32 | 33 | .row0 { 34 | x background:white; 35 | x padding:10px 0 10px; 36 | } 37 | 38 | .hotstring { 39 | width:60px; 40 | color:red; 41 | float:left; 42 | clear:left; 43 | padding-top:10px; 44 | padding-left:5px; 45 | border-top:1px solid #ddd; 46 | } 47 | 48 | .replacement { 49 | width:65%; 50 | float:left; 51 | padding:10px 20px; 52 | border-top:1px solid #ddd; 53 | border-right:1px solid #ddd; 54 | border-left:1px solid #ddd; 55 | } 56 | 57 | .trigger { 58 | float:left; 59 | clear:right; 60 | width:5%; 61 | padding-left:10px; 62 | padding-top:10px; 63 | border-top:1px solid #ddd; 64 | } -------------------------------------------------------------------------------- /resources/texter.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/texter.ico -------------------------------------------------------------------------------- /resources/texter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/texter.png -------------------------------------------------------------------------------- /resources/texter48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/texter48x48.png -------------------------------------------------------------------------------- /resources/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/resources/throbber.gif -------------------------------------------------------------------------------- /testers/0.6a/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/testers/0.6a/texter.exe -------------------------------------------------------------------------------- /testers/0.6b/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/testers/0.6b/texter.exe -------------------------------------------------------------------------------- /testers/0.6c/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/testers/0.6c/texter.exe -------------------------------------------------------------------------------- /testers/0.6d/texter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/testers/0.6d/texter.exe -------------------------------------------------------------------------------- /texter.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adampash/texter/5fae19b5876c68f02b8da727e6feabed2c3c521a/texter.ahk --------------------------------------------------------------------------------