Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Only select tables in current story

Tagged: ,

Return to Member Forum

  • Author
    Posts
    • #34080

      Thanks to Jongwareâ??s examples, I have written a script to processes tables and conditionally alter column widths but the scope is currently document wide. Could anyone please give me an example of how to limit the processed tables to just the current story, or even better, only tables included within selected text.

    • #34090

      Glad you like the article! This is, by the way, exactly how I learned to write scripts: start with an original working script, customize some details to fit, and then try to change it to do *exactly* what you need.

      The line that’s responsible for processing tables document-wide is this one, in the function checkUserSelection:

      allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();

      To process only tables in the ‘current’ story, change it to this:

      allTables = app.selection[0].parentStory.tables.everyItem().getElements();

      .. and to process only tables inside a text selection, try this:

      allTables = app.selection[0].tables.everyItem().getElements();

    • #34097

      Thanks once again Jongware, that works perfectly. I am really enjoying scripting and those I have written so far have cut a lot of time and tedium from my work.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads