I'm using AHK and using the text replacement a lot.
However, when I'm using the 'send' function it is quite slow at times.
I've changed this with a function SetText() or AddText()
Code: Select all
SetText(text) {
ControlGetFocus, current, A
ControlSetText, %current%, %text%, A
Send ^{end}
}
AddText(text) {
Sleep, 50
ControlGetFocus, current, A
ControlGetText, currenttext, %current%, A
ControlSetText, %current%, % currenttext . text, A
Send ^{end}
}
Addtext adds the new text to the existing text
This is a lot faster than using send.
However, sometimes when I'm working in the middle of a textbox and I want to add the text at the current position (so with text before and after the cursor)
Is there a way to get the text before and after the cursor as a variable? so you can do:existing text,
(cursor is here and I want to place the new text here)
existing text
Code: Select all
ControlSetText, %current%, % textbeforecursor . text . textaftercursor, A
Best,
Justin