Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Help With a FINE Macro

User Image
FlinOrandee
15 discussion posts
Hi,

Got OUTSTANDING support herehttps://www.clipboardfusion.com/Discussions/View/excel-linebreak-removing-premade-macro/?ID=d9bbf917-9390-477f-9095-a69bd1001a1d#7 with a Macro. REALLY grateful for that! THANK YOU < Binary Fortress!!!

I also use it a lot with PDFs that often have text like this:

It was a dark and stormy
night and Snoopy was
sleeping on top of his
doghouse soundly. Charlie
Brown...

What this FINE MAcro does is it not ONLY copies all hose lines. BUT...it ALSO ties them all back together. So that when we paste we get:

It was a dark and stormy night and Snoopy was sleeping on top of his doghouse soundly. Charlie Brown...

Only challenge that I'm having is that it often leaves TWO spaces where the linhes should join. Something like:

It was a dark and stormy__night and Snoopy was__sleeping on top of his__doghouse soundly. Charlie __Brown...

(used underlines __ to illustrate two spaces as forum was collapsing spaces)

What do you think is happening?

Sincerely,

Flin
11 days ago (modified 11 days ago)  • #1
User Image
C# Clouseau
30 discussion posts
See in macros, https://www.clipboardfusion.com/Macros/View/?ID=b3083488-3fda-4bf4-ac96-0b268e9204ee.
10 days ago  • #2
User Image
FlinOrandee
15 discussion posts
Hi, Inspector C# Clouseau! :)

THANK you for replying.

Among the Macros listed, which one do you think is going to be the one I'm shooting for?

Sincerely,

Flin
9 days ago  • #3
User Image
C# Clouseau
30 discussion posts
Hi, Flin,

You are a connaisseur, Cato my yellow friend!

The macro that was in my link.
copy the lines below and put these in a 'new' macro:

using System;
using System.Text.RegularExpressions;
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
Regex regex = new Regex(@" {2,}");
return regex.Replace(text, " ").Trim();
}
}

Otherwise, do this in your scrubbing-trigger, Add, Text Replace:
Replace text, and than type 6 spaces to be replaced by 1 space
Replace text, and than type 5 spaces to be replaced by 1 space
and so on (4,3 ..) and ending with:
Replace text, and than type 2 spaces to be replaced by 1 space
In whatever pdf-text or other text copied, most redundant spaces will be eliminated.

Regards,
Dr Schultz from the village, and my dog doesn't bite .... :-)
9 days ago  • #4
User Image
FlinOrandee
15 discussion posts
I thought you said your dog doesn't bite?!!

:laugh:

Mint. Just the BEST!

I tried a few times editing the Macro I'm using, but I couldn't seem to get it to work as I'm having some trouble with the syntax.

I've attached the file here. Please could you help me to place it in the correct position within the Macro?

I apologize for troubling you, but I just couldn't seem to get it to go.

Sincerely,

Flin
• Attachment: where-to-place.txt [2,057 bytes]
7 days ago (modified 7 days ago)  • #5
User Image
C# Clouseau
30 discussion posts
See attached file Flin, I also added some remarks and did some other adjustments. "I hope I didn't pulled the wrong one". Not clear to me what you want to have cleaned in your clipboard items. But the macro is working and cleaning. And no guarantees at all C# is completely new for me. In former days I did some simple programming and creating macros, so I understand a little what has to be done. And finally, the macro doesn't bite. You might only miss some spaces :-)
• Attachment: FlinTest.cfmacro [23,392 bytes]
7 days ago  • #6
User Image
C# Clouseau
30 discussion posts
... and attached file to be imported in Settings and tab Macro. " It is not my dog!"
7 days ago  • #7
Was this helpful?  Login to Vote(1)  Login to Vote(-)