The problem I am experiencing is that the text replacement works fine for a while, and then I start to get a repetitive "I" sent as if it's from the keyboard. The following is my code, it is loading a text file at startup and using that to establish the array. The text file is 1077 lines long:
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <HotString.au3>
Opt("SendKeyDelay", 0)
Opt("SendKeyDownDelay", 1)
Global $aRetArray, $sFilePath = @ScriptDir & "\Test.txt"
FileLoad()
SetHotStrings()
While 1
Sleep(100)
WEnd
Func FileLoad()
_FileReadToArray($sFilePath, $aRetArray, Default , "¬")
If @error = 1 Then
MsgBox(0,"Error opening specified file","")
ElseIf @error = 2 Then
MsgBox(0,"Unable to split the file","")
ElseIf @error = 3 Then
MsgBox(0,"File lines have different numbers of fields","")
ElseIf @error = 4 Then
MsgBox(0,"No delimiters found","")
EndIf
_ArrayDisplay($aRetArray, "2D array - count", Default, 8)
EndFunc ;==>FileLoad
Func SetHotStrings()
For $x = 1 to UBound($aRetArray) - 1
HotStringSet($aRetArray[$x][0],Expand)
Next
EndFunc ;==>SetHotStrings
Func Expand($hotstring)
Local $strlength = StringLen($hotstring)
Send("{BACKSPACE " & $strlength & "}")
For $x = 1 To UBound($aRetArray) - 1
If $aRetArray[$x][0] = $hotstring Then
Send($aRetArray[$x][1])
ExitLoop
EndIf
Next
EndFunc ;==>Expand