1

I'm trying to extract information about images placed into a Pages ('09 v 4.3) document. The following script is my attempt:

tell application "Pages"
    tell front document
        repeat with pg in pages
            tell pg
                set im to images
                repeat with i in im
                    tell i
                        get image data
                    end tell
                end repeat
            end tell
        end repeat
    end tell
end tell

While it doesn't produce errors, and finds every image, it doesn't return any data either and I don't know why it doesn't:

get every image of item 1 of every page of document 1
        --> {image 1 of foreground layer of page 1 of document id 14126328}
get image data of image 1 of foreground layer of page 1 of document id 14126328
get every image of item 2 of every page of document 1
        --> {image 1 of foreground layer of page 2 of document id 14126328}
get image data of image 1 of foreground layer of page 2 of document id 14126328
get every image of item 4 of every page of document 1
    --> {image 1 of foreground layer of page 4 of document id 14126328}
get image data of image 1 of foreground layer of page 4 of document id 14126328
...
1

Nice work you almost got it. I would suggest looking at the properties instead of the data ;)

tell application "Pages"
    tell front document
        repeat with pg in pages
            tell pg
                set im to images
                repeat with i in im
                    tell i
                        get properties
                    end tell
                end repeat
            end tell
        end repeat
    end tell
end tell
1
  • Thanks! (+1) With AppleScript you never know how close you are... :) Do you happen to know how to get the image's filename - there's no image data property in the listing of this script, although it's in the dictionary? – cormullion Oct 15 '13 at 18:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .