Skip to main content
Known Participant
March 19, 2024
Answered

How to apply Keep Option by script?

  • March 19, 2024
  • 2 replies
  • 628 views

I want a shortcut to quickly apply keep option (start in next column)

to the paragraph in which the cursor is in

Is this possible using a script?

 

This topic has been closed for replies.
Correct answer rob day

Try this:

 

var s = app.activeDocument.selection[0];

if (s.hasOwnProperty("paragraphs")) {
    var p = s.paragraphs
    for (var i = 0; i < p.length; i++){
        p[i].startParagraph = StartParagraph.NEXT_COLUMN
    };   
} 

2 replies

James Gifford—NitroPress
Legend
March 19, 2024

Numpad-Enter?

Mendi MAuthor
Known Participant
March 19, 2024

I need it to be easily undone by cleaning overrides

rob day
Community Expert
rob dayCommunity ExpertCorrect answer
Community Expert
March 19, 2024

Try this:

 

var s = app.activeDocument.selection[0];

if (s.hasOwnProperty("paragraphs")) {
    var p = s.paragraphs
    for (var i = 0; i < p.length; i++){
        p[i].startParagraph = StartParagraph.NEXT_COLUMN
    };   
} 
Willi Adelberger
Community Expert
Community Expert
March 19, 2024

Why not defining the paragraph styles correctly?

Mendi MAuthor
Known Participant
March 19, 2024

It can be several styles

&

Willi Adelberger
Community Expert
Community Expert
March 19, 2024

Every paragraph style has to have correct keep options. That is normal. Normal documents have 20 to 50 Paragraph styles.