I have the following function in AutoHotkey that attaches the strings Left and Right as a prefix and suffix to a given text string that is pre-selected on a text file:
TagWrapper(Left, Right)
{
ClipSaved := ClipboardAll
Clipboard =
send ^c
Clipboard = %Left%%clipboard%%Right%
send ^v
Clipboard := ClipSaved
ClipSaved =
}
The function works by copying the text into the clipboard, and then adding the prefix Left and suffix Right to it.
Now, I would like to add line breaks between Left and clipboard and also between clipboard and Right so that the text is wrapped between two lines with contents in Left and Right. How can I do this?
I have tried adding
`n
or
`r
between the prefix and suffix and the clipboard, e.g. as follows :
TagWrapper(Left, Right)
{
ClipSaved := ClipboardAll
Clipboard =
send ^c
Clipboard = %Left%%`nclipboard`n%%Right%
send ^v
Clipboard := ClipSaved
ClipSaved =
}
but that didn't work (the script can't even run). Any thoughts?
