'[AHK ]Copying multiple Lines and pasting them modified in a single line
So I basically just wanna make a script that copies multiple lines of a text for example:
:suemote: situps ─ 60
:sqemote: squats ─ 40
:puemote: pushups ─ 30
and modifies it to a single line text:
I did today 60 situps 40 squats 30 pushups , wbu?
Important is that it doesn't paste any text which is between the colons and that the amount of lines doesn't matter or is not given. I can already copy-paste modified text on a single line, but doing that on multiple lines seems too complicated for me. Is it possible to replace the enter with a space? It would be really nice if anyone can also explain the commands that they are using, I did that text modification thing with vStr so it would be really cool if it's possible to use it also on multiple lines.
Solution 1:[1]
From the given info I could come up with this,
myvar =
(
:suemote: situps ? 60
:sqemote: squats ? 40
:puemote: pushups ? 30
)
clearvar := RegExReplace(myvar, ":.*?: ", "")
fixedlines := StrSplit(clearvar, "`n")
For index, actions In fixedlines
{
act .= RegExReplace(actions, "(.*?)(?: ?)(.*?)$", "$2 $1")
}
MsgBox, I did today %act%, wbu?
It returns as requested.
I'm no pro, if there is a more efficent way please post so I do learn as well.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Toorop |
