Using HotStrings like that does tend to be very slow, in my experience. I have converted all of my HotStrings to use WIndows paste rather than using the built-in Send/SendPlay/SendRaw functions of AHK. Some of my HotStrings are around 10K or more and they paste instantly because it is not sending each individual character.
So, try something like this:
Code: Select all
pasteHotString(text:="") {
prevClipboard := ClipboardAll
Clipboard := text
ClipWait()
Sleep, 50
SendInput, ^v
; wait or the clipboard is replaced with previous before it gets a chance to paste it, resulting in pasting the original clipboard
Sleep, 250
Clipboard := prevClipboard
Sleep, 20
prevClipboard := ""
}
::btw::
pasteHotString("by the way by the way by the way by the way by the way by the way by the way by the way")
return
The reason for the calls to
Sleep is that on one of my computers, AHK will run the script faster than the actually processing of the commands and it ends up pasting the wrong thing. You can likely remove them safely.
Mike V.