Copy link to clipboard
Copied
Dear all
How can we make a macro, which will select the whole paragraph from the current cursor position and copy it again select the next paragraph if we press that key again...
I use this script for that:
try { if (app.selection[0] instanceof InsertionPoint) { var par = app.selection[0].paragraphs[0]; if (par.characters[-1].contents != "\r") par.insertionPoints[-1].contents = "\r"; par.duplicate (LocationOptions.after, par.insertionPoints[-1]) } else { var sel = app.selection[0]; sel.duplicate (LocationOptions.after, sel.insertionPoints[-1]); } } catch (_){}
With an insertion point se
...Copy link to clipboard
Copied
I use this script for that:
try { if (app.selection[0] instanceof InsertionPoint) { var par = app.selection[0].paragraphs[0]; if (par.characters[-1].contents != "\r") par.insertionPoints[-1].contents = "\r"; par.duplicate (LocationOptions.after, par.insertionPoints[-1]) } else { var sel = app.selection[0]; sel.duplicate (LocationOptions.after, sel.insertionPoints[-1]); } } catch (_){}
With an insertion point selected, it duplicates the current paragraph after itself. If you've selected anything else it duplicates that selection after the selection's last insertion point. In other words, the script mimics the ESTK's Ctrl+D key (going back probably to WordStar). Note that you run the script once: no need for copy and paste.
Peter
Copy link to clipboard
Copied
Dear Peter,
Thanks for reply but the actual requirement was to select and copy text from the current position of the cursor till the end of the paragraph, and change the position of the cursor to the endpoint of the selected paragraph and not to paste only copy.
for example if my cursor position is after "boy" and before "comma", and run the script than it should select and copy the text
",Now he is in america"
if it again run the script than it should select the next paragraph.
Rabs was a good boy, Now he is in America.
America is one of the best countries in the world"
Copy link to clipboard
Copied
That script is a pointer to how you could do it.
Peter
Find more inspiration, events, and resources on the new Adobe Community
Explore Now