Pasting from Clipboard Line by Line  SOLVED

User-to-User discussion about the PhraseExpress macro programming.
Post Reply
Posts: 2
Joined: 11 May 19, 22:07

Pasting from Clipboard Line by Line

Post by SandBird » 11 May 19, 22:17

I have searched the forms briefly but with no luck.

What I am trying to do is to paste line at a time from clipboard.
Scenario steps:
1. Copy a multi line text (a list) to the clipboard.
2. Use a hotkey to paste the first line.
3. Using the same hotkey again, will paste the 2nd line from that same clipboard and so on.

Is it possible?

Any help would greatly appreciated.

Thanks in advance!

Using PhraseExpress Free 14.0.139f for Windows

Peter Stotz
PhraseExpress Expert
Posts: 793
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 13 May 19, 06:24

My suggestion:

Code: Select all

(* 20190513 • Outputs the currently first line of the clipboard content
   Delete empty lines from the clipboard (RegEx)
*){#setclipboard {#trim {#regexrep -text {#insertclipboard} -expr ^\h*\R -repexpr }}{#asc 13}}(* 
  Output line 1 of the current clipboard content
*)»{#trim {#substr {#insertclipboard} -from 1 -count {#calc {#pos {#insertclipboard} -substr {#asc 13}}-1 -round 0}}}«(* 
  Remove line 1 from clipboard content
*){#setclipboard {#substr {#insertclipboard} -from {#calc {#pos {#insertclipboard} -substr {#asc 13}}+1 -round 0} -count }}
The best way to use the macro program is to assign a hotkey to it.
Windows 10 - PhraseExpress v14.0.143

Posts: 2
Joined: 11 May 19, 22:07

Post by SandBird » 13 May 19, 06:34

Hello Peter,

Thank you so much, simply amazing - this works!

Post Reply