Turning the Tables

At this point I remember that every illustration is embedded in a table. According to FrameMaker’s dictionary, the find command has an option to find a table. Perhaps this will work better if I start by dealing with tables instead of anchored frames. So I try this:

tell application "FrameMaker 7.0"
    find table in document "gromit:Users:matt2:extra:astdg:ch02"
    select insertion point after selection
end tell

Gee, there’s no error. Could it be that this is actually working? To find out, I’ll try to cycle through several tables, collecting references to them to see if I’m finding different ones:

tell application "FrameMaker 7.0"
    set allTables to {}
    repeat 5 times
        set oneTable to find table ¬
            in document "gromit:Users:matt2:extra:astdg:ch02"
        set end of allTables to oneTable
        select insertion point after selection
    end repeat
end tell
allTables

Here’s the result:

{table 33 of document "gromit:Users:matt2:extra:astdg:ch02"
    of application "FrameMaker 7.0",
table 34 of document "gromit:Users:matt2:extra:astdg:ch02"
    of application "FrameMaker 7.0",
table 32 of document "gromit:Users:matt2:extra:astdg:ch02"
    of application "FrameMaker 7.0",
table 35 of document "gromit:Users:matt2:extra:astdg:ch02"
    of application "FrameMaker 7.0",
table 26 of document "gromit:Users:matt2:extra:astdg:ch02"
    of application "FrameMaker 7.0"}

That’s great. The numbers are once again mystifying; I have no idea why FrameMaker thinks there are at least 35 tables in this document, and of course it is numbering ...

Get AppleScript: The Definitive Guide, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.