Copy Text and Paste It Line by Line

Hi there,

I would like to copy a text with a bunch of lines and the paste each line one by one via a hot key.

TIA
Cary

You can do something like this:

Search Clipboard For Regular Expression "\A(.*)[\r\n]+(?s:.*)
   Into Variables "First Line" and "Remaining Lines"
Then Insert Text by Pasting "%First Line%"
Pause a short while to allow it to complete
Set Clipboard to Text "%Remaining Lines%"
Delete Past Clipboard: 1

You’ll want to add some extra details to handle the case when the clipboard becomes empty, and/or handle the case when you have characters in the clipboard, but no lone ending characters.

An alternative would be to have an initial macro that squirrelled away the clipboard into a variable, and then operate on the variable.

1 Like

Thanks Peter,

I think the regex is not correct. I put \A(.+)[\r\n]+([\s\S]*) and it’s working properly.

Thanks again for you help. Very useful.
Cary

1 Like

The Markup engine messed up the regex, I’ve edited it so it shows up properly. Thanks.

A post was split to a new topic: How Do I Copy Cells From Excel and Paste Contents of Each Cell on a Separate Line?