How can I insert a new line between 2 specific duplicate lines in the sequence?
-
I want to insert a new line, {Delay 0.05} between every 2 specific duplicate lines like
Before:
{LMouse up
{LMouse downAfter:
{LMouse up
{Delay 0.05}
{LMouse downExample: (The numbers on the end change
{Delay 0.14}
{Move (940,166)}
{Delay 0.05}
{LMouse down (940,166)}
{Delay 0.05}
{LMouse up (940,166)}
{Delay 0.05}
{LMouse down (940,166)}
{LMouse up (940,166)}
{Delay 0.05}
{LMouse down (940,166)}
{Delay 0.05}
{LMouse up (940,166)}
{LMouse down (940,166)}
{LMouse up (941,172)}
{LMouse down (941,172)}
{Delay 0.05}
{LMouse up (941,172)}
{Delay 0.05}
{LMouse down (941,172)}
{Delay 0.05}
{LMouse up (941,172)}
{LMouse down (941,172)}
{Delay 0.05}
{LMouse up (941,172)}
{LMouse down (941,172)} -
@clayman648 said in How can I insert a new line between 2 specific duplicate lines in the sequence?:
I want to insert a new line, {Delay 0.05} between every 2 specific duplicate lines like
What you ask is certainly possible. There is an issue with your example though. It doesn’t appear to be consistent with your request. In one area you have a up, then down, then up and down. Only then do you have the delay. Later you have the up and down set without a delay between them. I’m assuming you just weren’t that good at providing an accurate “after” example, that is if the long example is supposed to show an after look.
So using the Replace function you need to have the search mode set to “regular expression”. Then we have:
Find What:(?-s)^({lmouse up.*)(\R)({lmouse down.*)
Replace With:\1\2{Delay 0.05}\2\3
You can click on either “Replace” (which means you singularly click for each replacement) or “Replace All” which will change all the sets.
Have a check of your example and if you now believe there is more to the request then tell us. Otherwise attempt my solution (above) and check your result.
Terry
-
Oh my god, thank you so much Terry!
in future, could I just change {lmouse up and {lmouse down to do the same thing? or is it different if the starting character isn’t special?
-
Not sure exactly what you mean. However if you are just changing the alphabetic characters, then yes, other words would also work.
There are some special characters recognised by regular expressions,
{
and}
can be depending on context. in this case the escape character wasn’t needed.Our FAQ posts have references to the regular expressions system, so if you want to learn more, start there.
Terry
-
@Terry-R Using
{Delay 0.05}\2\1\2\3
in the Replace field will be more accurate