Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
Dave Warren
9 discussion posts
Anyone have a macro to wordwrap text at ~72 characters and add quote marks?

The goal is to better handle replies in a web-based ticket system that does a poor job of quoting. At a minimum, what I'd like would be to strip any leading spaces and > marks, word-wrap lines at or around 72-78 characters, then add a "> " to the start of each line.

Note that we generally only have one level of quoting as we trim very aggressively, so supporting multiple quote levels isn't critical.
Feb 23, 2013  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
We should be able to write up a macro that will do this. I'll work on it as soon as I have a chance :)
Feb 25, 2013  • #2
User Image
Dave Warren
9 discussion posts
Thanks!
Feb 25, 2013  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
To clarify, do you want the ">" added to the start of each line, AND the whole block of text wrapped in quotes?
Feb 27, 2013  • #4
User Image
Dave Warren
9 discussion posts
Oops, I just realized my request might not have been as clear as I intended -- I have my head buried so far in the email world that when I hear quote marks, I think > marks at the start of a line, not "proper" doublequotes. Basically I'm wanting to be able to reply to messages from a web-based forum type system via email, but quote the original message.

My goal is to take text, word-wrap it (somewhere around 72 characters, a bit shorter or a bit longer is fine since words are consistent lengths), then prepend every line with "> "

Prepending is easy, but I'm less certain how I'd word-wrap a paragraph. If I were to take the message I'm writing here and run it through, the results would look like this:

Code

> Oops, I just realized my request might not have been as clear as I 
> intended -- I have my head buried so far in the email world that 
> when I hear quote marks, I think > marks at the start of a line, 
> not "proper" doublequotes. Basically I'm wanting to be able to reply 
> to messages from a web-based forum type system via email, but quote 
> the original message.
> 
> My goal is to take text, word-wrap it (somewhere around 72 characters, 
> a bit shorter or a bit longer is fine since words are consistent
> lengths), then prepend every line with "> "
> 
> Prepending is easy, but I'm less certain how I'd word-wrap a paragraph.
> If I were to take the message I'm writing here and run it through, the 
> results would look like this:
Feb 27, 2013  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, cool, just wanted to make sure :)

One of our devs here is going to make a macro that can do this, and I'll post it as soon as it's available.

Thanks!
Mar 2, 2013  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, here we go! Our most excellent co-op student, Thomas whipped up this macro for you :)

http://www.clipboardfusion.com/Macros/View/?ID=766e8145-968e-4bc2-b7a1-9640c4e38918
Mar 4, 2013  • #7
User Image
Dave Warren
9 discussion posts
Thanks, it's almost perfect -- However, the first line of each paragraph (other than the first) is missing a > quote mark.

I poked at it a bit and I'm not quite sure how to get around this, but my C# skills don't actually exist, which probably explains my inability to tweak it :)

It also drops multiple consecutive spaces, but changing StringSplitOptions.RemoveEmptyEntries to StringSplitOptions.None seemed to work around that without anything too obvious breaking.

Any chance you/Thomas could tweak it so that additional paragraphs get an initial quote mark? -- I don't really care if the blank line between paragraphs gets a quote mark or not, although it wouldn't hurt if it did (but it's generally fairly readable either way, if this is difficult)
Mar 4, 2013  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Oh! I didn't test it with multiple paragraphs :)

We'll definitely look into it again and figure out how to fix it.
Mar 5, 2013  • #9
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, here we go. Thomas has updated the macro to account for blocks of text that include line breaks. Seems to work great now :)
http://www.clipboardfusion.com/Macros/View/?ID=766e8145-968e-4bc2-b7a1-9640c4e38918
Mar 6, 2013  • #10
User Image
Dave Warren
9 discussion posts
Well that's just beautiful, thanks!
Mar 7, 2013  • #11
Keith Lammers (BFS)'s profile on WallpaperFusion.com
No problem Dave!
Mar 8, 2013  • #12
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)