Adding HTML to the front of each line in clipboard

Hi,

Got an interesting Script that is currently in AutoHotkey that we're migrating away from.

Basically this script takes the content of the Clipboard and then adds HTML
s to the each line.

eg this text

Bridges - Parker discovers he's a victim of identity theft while investigating the unusual murder of a Navy ensign. Also, Knight and Jimmy face hurdles in their relationship as their connection heightens, on the CBS Original series NCIS, Monday, Jan. 16 (9:00-10:00 PM, ET/PT) on the CBS Television Network and available to stream live and on demand on Paramount+*.

REGULAR CAST:

Sean Murray (NCIS Special Agent Timothy McGee)
Wilmer Valderrama (NCIS Special Agent Nicholas  Torres)
Brian Dietzen (Medical Examiner Jimmy Palmer)
Diona Reasonover Katrina Law (Forensic Scientist Kasie Hines)
(NCIS Special Agent Jessica Knight)
Rocky Carroll (NCIS Director Leon Vance)
Gary Cole (FBI Special Agent Alden Parker)

Would become this

Bridges - Parker discovers he's a victim of identity theft while investigating the unusual murder of a Navy ensign. Also, Knight and Jimmy face hurdles in their relationship as their connection heightens, on the CBS Original series NCIS, Monday, Jan. 16 (9:00-10:00 PM, ET/PT) on the CBS Television Network and available to stream live and on demand on Paramount+*.
<br />
<br />REGULAR CAST:
<br />
<br />Sean Murray (NCIS Special Agent Timothy McGee)
<br />Wilmer Valderrama (NCIS Special Agent Nicholas Torres)
<br />Brian Dietzen (Medical Examiner Jimmy Palmer)
<br />Diona Reasonover Katrina Law (Forensic Scientist Kasie Hines)
<br />(NCIS Special Agent Jessica Knight)
<br />Rocky Carroll (NCIS Director Leon Vance)
<br />Gary Cole (FBI Special Agent Alden Parker)

Basically for each new line there would be a
inserted at the front.

Hey again Andy,

If I'm understanding correctly then I think this is another use of replace(

{=replace({clipboard},"\n","\n<br />")}

When using your examples, it output for me exactly what you were looking for.

Basically, I'm replacing each linebreak with a linebreak and a br tag.

2 Likes

Wow, you make it look so simple. This is really great, thank you once again !