Thread View: adobe.scripting.indesign
15 messages
15 total messages
Started by Marco Lugli
Tue, 10 Mar 2009 09:34
Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 09:34
Date: Tue, 10 Mar 2009 09:34
5 lines
735 bytes
735 bytes
Hello All, is it possible to script the Keep Option feature of Paragraph Styles in Indesign CS3? It seems I can't find that in the Object Model. Thanks to all in advance Marco
Re: Paragraph Style - Keep Options
Author: Peter Kahrel
Date: Tue, 10 Mar 2009 09:40
Date: Tue, 10 Mar 2009 09:40
5 lines
674 bytes
674 bytes
Look under paragraph, then under keep: paragraph.keepWithNext = number Peter
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 10:14
Date: Tue, 10 Mar 2009 10:14
19 lines
994 bytes
994 bytes
Thanks Peter for the information -
I'm trying do make a script to manage the Keep Option property of a paragraph.
Here's my attempt:
function main(){
var mySelection = app.selection[0];
if (mySelection){
myProcessText(mySelection);
}
function myProcessText(mySelection){
mySelection.keepWithNext = 1;
}
}
But it doesn't seem to work.
Have you got any suggestions?
Thanks
Marco
Re: Paragraph Style - Keep Options
Author: jongware
Date: Tue, 10 Mar 2009 10:42
Date: Tue, 10 Mar 2009 10:42
19 lines
1445 bytes
1445 bytes
The type of the selection matters; keepWithNext is only part of Paragraphs, and your selection may be something else. I tested the type of mySelection using
alert ("Selection is of type "+mySelection.constructor.name);
and it gave back "InsertionPoint", "Text", "Word" -- ah, finally! If you triple-click a paragraph, only then it returns "Paragraph".
So, check if the type is "Paragraph"; if so, use that, else check the selection's .parent property? Doesn't work. Any parent of text items seem to be "Story".
But there is another interesting property all these text types have in common: they all have "paragraphs" (an array). A quick check using
mySelection.paragraphs[0].fillTint = 25;
shows that, indeed, you can use this for direct access to 'the selected paragraph'.
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 11:01
Date: Tue, 10 Mar 2009 11:01
17 lines
992 bytes
992 bytes
Hi jongware,
I modified the script as you suggested:
function main(){
var mySelection = app.selection[0];
if (mySelection){
myProcessText(mySelection);
}
function myProcessText(mySelection){
mySelection.paragraphs[0].keepWithNext = 1;
}
}
But still no results.. any suggestions?
Thanks
Marco
Re: Paragraph Style - Keep Options
Author: jongware
Date: Tue, 10 Mar 2009 11:31
Date: Tue, 10 Mar 2009 11:31
10 lines
912 bytes
912 bytes
If you insert
alert ("hi!");
somewhere in either your main or your myProcessText function ... does it display?
You wrote two functions, and you call 'myProcessText' from 'main'. However, you don't call 'main' anywhere. This is not C :-) The initial 'function main()' and its associated brackets are not necessary.
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 13:36
Date: Tue, 10 Mar 2009 13:36
2 lines
683 bytes
683 bytes
Yes, I see the alert message; but I still can't apply the keep option property..
Re: Paragraph Style - Keep Options
Author: Dave_Saunders
Date: Tue, 10 Mar 2009 14:28
Date: Tue, 10 Mar 2009 14:28
3 lines
859 bytes
859 bytes
Your script looks incomplete. I see no call of main(). Did you just leave that out of your posted example? Or is it not there? If it is not there, then that's why nothing is happening. Dave
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 14:45
Date: Tue, 10 Mar 2009 14:45
16 lines
911 bytes
911 bytes
Here's the revised script:
function main(){
var mySelection = app.selection[0];
if (mySelection){
myProcessText(mySelection);
}
function myProcessText(mySelection){
mySelection.paragraphs[0].keepWithNext = 1;
}
}
main();
Still does not function
Marco
Re: Paragraph Style - Keep Options
Author: Dave_Saunders
Date: Tue, 10 Mar 2009 15:00
Date: Tue, 10 Mar 2009 15:00
9 lines
704 bytes
704 bytes
What if you add: alert(app.selection[0].keepWithNext); after the call to main(). What does the alert say? Dave
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 15:06
Date: Tue, 10 Mar 2009 15:06
3 lines
606 bytes
606 bytes
It says: 1 Marco
Re: Paragraph Style - Keep Options
Author: jongware
Date: Tue, 10 Mar 2009 15:31
Date: Tue, 10 Mar 2009 15:31
2 lines
654 bytes
654 bytes
That's good news -- it appears to be working! Why do you think it does not?
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 15:44
Date: Tue, 10 Mar 2009 15:44
3 lines
876 bytes
876 bytes
May be we are not talking of the same thing - I have a series of threaded text frames with some paragraphs in them. My aim is to script a function that, once launched, will move the selected paragraph in the next threaded text frame. This I mean for keep option.. Marco
Re: Paragraph Style - Keep Options
Author: jongware
Date: Tue, 10 Mar 2009 16:30
Date: Tue, 10 Mar 2009 16:30
8 lines
1036 bytes
1036 bytes
You're right. The keepWithNext option is the number n in the "Keep with Next n lines" dialog. However, the one you're after is "Start Paragraph: [xxx]". Fortunately, this value can also be changed in the Paragraph properties: .startParagraph ("The location at which to start the paragraph.") You can set
paragraphs[0].startParagraph
to any of the values mentioned in the ESTK help; in your case, you probably want StartParagraph.NEXT_FRAME
Re: Paragraph Style - Keep Options
Author: Marco Lugli
Date: Tue, 10 Mar 2009 17:34
Date: Tue, 10 Mar 2009 17:34
17 lines
900 bytes
900 bytes
Thanks jongware,
finally the working code:
function main(){
var mySelection = app.selection[0];
if (mySelection){
myProcessText(mySelection);
}
function myProcessText(mySelection){
mySelection.paragraphs[0].startParagraph = StartParagraph.NEXT_COLUMN;
}
}
main();
Thanks to all
Marco
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads