Applescript question: Deleting empty column from table

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Applescript question: Deleting empty column from table

Viewing 3 reply threads
  • Author
    Posts
    • #87714
      AaronA
      Participant

      Hello,

      I’m stumped as to why this code works (when selecting a table cell):

      tell application “Adobe InDesign CS6”
      activate
      tell active document

      tell parent of selection
      if items of contents of last column is “” then –have to break array down to items
      delete last column
      end if
      end tell
      end tell
      end tell

      …. but this code, where I’m trying to do the same for all tables document-wide, gets an error -1728:

      –delete empty columns (that previously were merged)

      tell application “Adobe InDesign CS6”
      activate
      tell active document
      set allTables to every table of every story

      repeat with i from 1 to count of allTables
      set myTable to item i of allTables
      tell myTable

      if items of contents of last column is “” then
      delete last column
      end if

      end tell
      end repeat
      end tell
      end tell

      (Actually the first one doesn’t work as I intend to — it only goes by the contents of the first cell of the column, because I don’t get how to ask if ALL cells are empty — but it at least doesn’t error like the 2nd.)

    • #87813
      Masood Ahmad
      Participant

      HI Aarona,

      I would suggest posting AppleScript related questions to the AppleScript dedicated site:

      https://macscripter.net/viewforum.php?id=2

      Hope you’ll find your answers there.

    • #87814
      AaronA
      Participant

      Thanks Masood! Yes, this forum doesn’t look terribly active. Cheers!

    • #87865

      Aaron, this isn’t true, but we speak Javascript instead of Applescript! ;-)

      Kai

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>