Poco Script FAQ - Copying an entire message to the clipboard

Poco Script FAQ - Copying an entire message to the clipboard

Q: How do I copy the contents of a message, including the headers, to the clipboard? I tried using the command: CopyToClipboard %message but this only yielded the string %message, not the message itself.
 
A: From the Poco help file:

The CopyToClipboard accepts only a variable or a single text string (quotes needed for multiple words).

In your case it was %message. The following works:

ReadAllHeaders $heads %message ReadRawBody $bods %message [make into one variable AppendBody $heads $bods CopyToClipboard $heads

Slaven's explanation and solution were:

CopyToClipboard command can only use a string and integer variable, not a message variable - message variable is not just plain text, and it does not work with all commands. To do what you want, try this:

ReadAllHeaders $a %message AppendBody $a "" ReadBody $b %message AppendBody $a $b CopyToClipboard $a

It is important to note the differences in the two scripts, Rudy's script (the first one), used the "ReadRawBody" command while Slaven used the "ReadBody" command. Rudy's solution will preserve HTML coding for messages that are sent in styled format while Slaven's will strip them out. Choose the one that meets your needs or customize the script to check the "Content-Type:" header. If it is "text/html" then prompt for whether or not to preserve the HTML coding.