I am trying to create a fairly simple text wrapper in AutoHotKey for use in programming. I got it to work with the clipboard, to copy the selected text, change it, and then paste it, but I try to refrain from using the clipboard, since it does not work well with my clipboard manager. Does anyone know how to do this?
!r:: ;Alt+R+%Char% = Wrap Text with Input Characters
ClipSave := ClipboardAll
Send ^c
Input, Char, L1
if ("" . Char = "{")
{
clipboard = {%clipboard%}
}
else if ("" . Char = "[")
{
clipboard = [%clipboard%]
}
else if ("" . Char = "(")
{
clipboard = (%clipboard%)
}
else
{
clipboard = %Char%%clipboard%%Char%
}
StringReplace, clipboard, clipboard,%A_SPACE%",", All
Send ^v
Clipboard := ClipSave
ClipSave =
return
Note. I saw ControlGet, text, Selectedand tried to implement it, but it did not work (without errors, without any action). If anyone has a solution, this will fix my problem.
source
share