Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
FlinOrandee
18 discussion posts
Hi,

This macro from the link below, and attached, is the BOMB! It's so USEFUL!!


I'm a teacher and...I do a LOT of lesson making, taking small quotes from texts to try to illustrate things. So, first - THANK YOU for this,and the AMAZING power that is Clipboard Fusion! : ) ) )

https://www.clipboardfusion.com/Discussions/View/excel-linebreak-removing-premade-macro/?ID=d9bbf917-9390-477f-9095-a69bd1001a1d


Please could you help me figure out how to make some small changes to this macro?

Right now I use it mostly in PDFs and Excel.

In PDFs, at the end of every line there's a line break. This macro will copy any number of lines, and then PASTE them all together. Linebreaks gone.
And! It DOES reattach them. So that the lines in a PDF

Cleon said to Plato are
you sure about that conclusion?

Copied and pasted would become:

Cleon said to Plato are you sure about that conclusion?

What's happening is between any lines joined...there's always a double space. For SHORT bits of text this is fine. Just a keystroke to go.
But, with longer texts, it can get to be hard to keep my poor powers of concentration sharp enough to find them. :laugh::P

Any way to get those joined lines to have just a single space in between?

Similarly, when the lines end in -, such as:

Lots of people try to re-
duce their environmental impact.

Becomes:
Lots of people try to re- duce their environmental impact.

So! Two wee bits of magic:

Please a way to join lines with just a single space in between?

Then, for those cases where one line ends with a dash, a way to delete the dash AND rejoin the word:

Lots of people try to re- duce their environmental impact.
Lots of people try to reduce their environmental impact.

I know there MAY be cases where the dash could get eaten wrongly. But, the number of cases would be few.

If these two fixes are possible...it would be a HUGE timesaver for this weary educator!

Sincerely,

Flin
Mar 31, 2022 (modified Mar 31, 2022)  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hello,

If you add in these two lines at the start of the script right below the other text replace lines, it should do what you're looking for:

Code

text = text.Replace("  ", " ");
text = text.Replace("- ", "");


Hope that helps!
Apr 1, 2022  • #2
User Image
FlinOrandee
18 discussion posts
Hi Owen,

Ah! BLESS you for taking the time to reply. When I see how hard you and your colleagues work to to help people I feel impressed. Thank you, Owen!

I put the lines in in the right places, I think. (Even added one EXTRA line of my own while I was testing - for TWO spaces. :D )

But, still getting the same results.

Seems like there may be ANOTHER character at the termination of each line in a PDF in some instances? So far, this is what I've seen googling around is:

CR (0xOD 13) or LF (0x0A 10)

What do you think is happening?

Sincerely,

Flin
• Attachment: 2022-04-03_16-27-38-317.png [12,050 bytes]
2022-04-03_16-27-38-317.png
2022-04-03_16-27-38-317.png
• Attachment: lf-and-cr.txt [2,055 bytes]
Apr 3, 2022 (modified Apr 3, 2022)  • #3
User Image
FlinOrandee
18 discussion posts
Ah! And, the PDF Editor developers (Pdf X-Change Editor) have kindly offered that a possible fix

They write:

"you haven't run into the CF/LF difference between Unix and Windows have you?

https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings

Notepad++ (as well as other programmers editors) have options to convert between the two: https://notepad-plus-plus.org/downloads/

I am keen to see if that helps."

Fingers crossed!

Sincerely,

Flin
Apr 4, 2022  • #4
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Can you try moving those lines you added in, to the end of those text replace lines (starting at line 16)? You'll want the line breaks to happen first, and then remove the extra spaces.

Thanks!
Apr 6, 2022  • #5
User Image
FlinOrandee
18 discussion posts
Hi Owen,
Ah! Will do. I'll post test results soon.
THANK YOU!!!
Sincerely,
Flin
Apr 8, 2022 (modified Apr 8, 2022)  • #6
User Image
FlinOrandee
18 discussion posts
Hi Owen,

Ah! BLESS you, Sir! Works like a CHARM!

CBF - CAN'T compute without it.

T H A N K Y O U ! ! !

Sincerely,

Flin
Apr 28, 2022  • #7
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Glad to hear :)
Apr 28, 2022  • #8
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)