Thread View: adobe.scripting.indesign
6 messages
6 total messages
Started by Len_Swierski
Mon, 23 Feb 2009 19:59
[JS, CS3] Need help changing tabStop positions of selected text
Author: Len_Swierski
Date: Mon, 23 Feb 2009 19:59
Date: Mon, 23 Feb 2009 19:59
4 lines
1152 bytes
1152 bytes
Hi all, I am writing a script to nudge the tabStop positions of selected text by one point at a time. Sometimes it will be only a tab character selected, and other times it could be several in the paragraph or maybe even the whole story. The problem I am encountering is that when I reference the tabStops as app.selection[0].tabStops it includes ALL the tabStops in the paragraph and NOT just the selected ones. Is there a way to get just the selected tabStops and add a point to their positions? It must be that my referencing is flawed. Thanks for any help. Regards, Len Swierski
Re: [JS, CS3] Need help changing tabStop positions of selected text
Author: Len_Swierski
Date: Mon, 23 Feb 2009 20:04
Date: Mon, 23 Feb 2009 20:04
5 lines
956 bytes
956 bytes
A little more info: When I select only a single tab character, the constructor name reports as "Character." However, when I select more than one character, the constructor name is "Text." When selecting all text (Cmd-A) the constructor name reports as "TextColumn." Could this be the reason for the bum referencing? Thanks, Len Swierski
Re: [JS, CS3] Need help changing tabStop positions of selected text
Author: Olav_Kvern
Date: Mon, 23 Feb 2009 20:06
Date: Mon, 23 Feb 2009 20:06
7 lines
1016 bytes
1016 bytes
Hi Len, The selection is the text, not the tab stop. That is, even if you have selected a tab character, you have not selected a tab stop. To find out which tab stop corresponds to the tab character you have selected, you'll have to work out the location of the tab character in the text. You might want to take a look at the TabUtilities.jsx example script to see how to do this. Thanks, Ole
Re: [JS, CS3] Need help changing tabStop positions of selected text
Author: Len_Swierski
Date: Mon, 23 Feb 2009 20:44
Date: Mon, 23 Feb 2009 20:44
7 lines
1062 bytes
1062 bytes
Thanks for pointing me in the right direction, Ole. I looked over the TabUtilities.jsx script. Seems like what I need to do is to run a "for" statement to find the index numbers of all the tab characters and then create a new array for the SELECTED ones in that collection. Their index numbers should correspond to the tabStop index numbers, right? How to do this all, though. Whew! Putting my thinking cap on now. Regards, Len Swierski
Re: [JS, CS3] Need help changing tabStop positions of selected text
Author: Olav_Kvern
Date: Mon, 23 Feb 2009 20:52
Date: Mon, 23 Feb 2009 20:52
9 lines
1419 bytes
1419 bytes
Hi Len, That's not a bad approach, but remember that there may be more tab characters than there are tab stops. I was thinking of getting the location of the selected tab stop relative to the left edge of the text frame (or column, if you're working with multi-column frames) and then comparing it to the location of the tab stop. But I think your approach will work just as well and be quicker. Also, remember that when you start moving tab stops around, the index of the tab stop within the tab stops collection can change. If you have tab stop A at 12pt and tab stop B at 16pt, then tab stop A will be item(0) and B will be item (1). But if you move A to 24pt, A will become item(1) and B will be item(0). The index of the tab stop is relative to its location on the tab ruler. Thanks, Ole
Re: [JS, CS3] Need help changing tabStop positions of selected text
Author: Len_Swierski
Date: Mon, 23 Feb 2009 21:12
Date: Mon, 23 Feb 2009 21:12
7 lines
1184 bytes
1184 bytes
Ole, thanks for that info. It's becoming clearer for me now. I think I can avoid overlapping the tabStop positions by allowing for that somewhere in the script, but first things first. The task at hand will only require nudging the tabStops by one point plus or minus (I'll have 2 scripts with keyboard shortcuts set to CTRL-NUM+ and CTRL-NUM-) so I will keep them from getting close by just watching the tab panel for now. Thanks again for your help. Regards, Len Swierski
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