0

I am attempting to create a script that automatically inputs a tabled/tabular slug at the base of an InDesign page - quite a common query on the internet and thus far have done very well by cobbling together bits of relevant script... Creates table, inputs variables, find page size etc etc... HOWEVER, I'm stuck when it comes to inputting logo - really want to input my company logo into one of the table cells. Just from Users' HD location.

Does anyone have any tips they could share on this? Again, this is Applescript for InDesign.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

1

The content of a cell is text. So you need to create a rectangle and insert the image there:

Found this on macscripter a while ago - Modify it to your needs (especially the image bounds - the size/position)

set placedimage to (choose file) as string

tell application "InDesign CC 2017"
   tell document 1
       tell table 1 of story 1
           tell cell 1
               set NewImage to make new rectangle at insertion point 1 with properties {label:"Photo 1"}
               set ImageBounds to geometric bounds of NewImage
               set geometric bounds of NewImage to {item 1 of ImageBounds, item 2 of ImageBounds, (item 1 of ImageBounds) + 24, (item 2 of ImageBounds) + 18}
           end tell
       end tell
       place placedimage on NewImage
   end tell
end tell
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
  • Hi Pat_Morita, sorry for the delay - thanks so much for your suggestion. After a fair bit of tweaking it creates a rectangle in the correct cell (yay!) but I get the following message upon run: "Adobe InDesign CC 2017 got an error: "NI_Logo6_CMYK_slug.jpg" doesn't understand the "place" message Any further suggestion? SO frustrating! Thanks jj – jjcreative Apr 04 '17 at 15:04
  • Try: tell newImage to place placedimage – Pat_Morita Apr 04 '17 at 15:58
  • Or add an "alias" before your filepath if it's not an alias already. Note that you must include the whole filepath as alias --> place alias placedimage on NewImage – Pat_Morita Apr 04 '17 at 18:24