Permalink
Browse files

Fixed a bug with new trigger mechanism: Hotstrings pairs like a and a…

…b or add and addy rendered the second match in the pair un-triggerable. Added a search check to determine if a possible match search has already been made... this seems to fix the bug.
  • Loading branch information...
1 parent e8ca640 commit 5a6d8f842efcea1e2c7ffa4d4a0fd0dd3d0d27b5 adam committed Sep 27, 2007
Showing with 25 additions and 16 deletions.
  1. +25 −16 texter.ahk
View
41 texter.ahk
@@ -34,28 +34,34 @@ FileRead, SpaceKeys, %SpaceCSV%
;Goto Start
WinGet PrevWinID, ID, A
SetTimer, MonitorWindows, 500
-EndKeys={Enter}{Esc} {Tab}{Right}{Left}{Up}{Down}{Del}{BS}{Home}{End}{PgUp}{PgDn}{SC77}
Loop
{
;wait for a matching hotstring
- Loop
- { ;grab input one character at a time looking for a match
- Input, UserInput, L1 V, %EndKeys%
+ if Search <>
+ {
+ Loop
+ { ;grab input one character at a time looking for a match
+ Input, UserInput, L1 V, %EndKeys%
;Tooltip, Input received, 10, 10
- if (SubStr(ErrorLevel, 1, 6) = "EndKey")
- { ;any end key resets the search for a match
- PossibleMatch=
- }
- else
- {
- PossibleMatch=%PossibleMatch%%UserInput%
- }
+ if (SubStr(ErrorLevel, 1, 6) = "EndKey")
+ { ;any end key resets the search for a match
+ PossibleMatch=
+ }
+ else
+ {
+ PossibleMatch=%PossibleMatch%%UserInput%
+ }
;Tooltip, PossibleMatch= %PossibleMatch%
- IfInString, HotStrings, |%PossibleMatch%|
- { ;found a match - go to trigger search
- break
- }
+ IfInString, HotStrings, |%PossibleMatch%|
+ { ;found a match - go to trigger search
+ break
+ }
+ } ; end of inner loop
+ }
+ else
+ {
+ ;msgbox, empty
}
if PossibleMatch in %NoTrigger%
{ ;matched in triggerless list
@@ -119,11 +125,13 @@ Loop
PossibleMatch=
PossHexMatch=
Match=
+ Search=0
}
else
{
PossibleMatch=%PossibleMatch%%UserInput%
SendInput, %UserInput%
+ Search=
}
}
return
@@ -300,6 +308,7 @@ ReplaceWAV = %A_ScriptDir%\resources\replace.wav
TexterPNG = %A_ScriptDir%\resources\texter.png
TexterICO = %A_ScriptDir%\resources\texter.ico
StyleCSS = %A_ScriptDir%\resources\style.css
+EndKeys={Enter}{Esc} {Tab}{Right}{Left}{Up}{Down}{Del}{BS}{Home}{End}{PgUp}{PgDn}{SC77}
return
READINI:

0 comments on commit 5a6d8f8

Please sign in to comment.