Skip to main content
Participating Frequently
June 9, 2020
Answered

How "Not to Select" line break with triple click?

  • June 9, 2020
  • 1 reply
  • 2584 views

I have a huge amount of copy-and-paste text with headings, paragraphs and different styles. I'm selecting a line of text with triple click. It works ok but it also selects the invisible line break character at the end of the line. So when i paste new text over the selected one the following text comes at the end of it and i have to hit enter every time to put it back to where it was.

Is there a way "not to select" the line break character with triple click?

 

This topic has been closed for replies.
Correct answer FRIdNGE

Using a KB shortcut associated to something "simplistic" like that to select, placing the cursor in text, all the para without the carriage-return! …  😉

 

// by FRIdNGE, Michel Allio [09/06/20]
var ip = app.selection[0].paragraphs[0].insertionPoints;
if ( app.selection[0].paragraphs[0].characters[-1].contents == "\r" ) ip.itemByRange(0,-2).select();
else ip.itemByRange(0,-1).select();

 

(^/)  The Jedi

 

1 reply

FRIdNGE
FRIdNGECorrect answer
June 9, 2020

Using a KB shortcut associated to something "simplistic" like that to select, placing the cursor in text, all the para without the carriage-return! …  😉

 

// by FRIdNGE, Michel Allio [09/06/20]
var ip = app.selection[0].paragraphs[0].insertionPoints;
if ( app.selection[0].paragraphs[0].characters[-1].contents == "\r" ) ip.itemByRange(0,-2).select();
else ip.itemByRange(0,-1).select();

 

(^/)  The Jedi

 

Participant
December 29, 2022

Great script, thank you! Would it be possible to make two scripts. One for selecting the paragraph hand copying the text and one for selecting the paragraph and paste it as plain text? So you could use two shortcuts to copy and paste. I tried to do it myself but im too bad at scripting

Robert at ID-Tasker
Legend
December 29, 2022

If you need to paste without formatting - Ctrl+Shift+V on PC.