Search code examples
applescriptadobe-illustrator

Automated importing/sizing of image illustrator


I’m trying to find a way to place an image into an illustrator document with AppleScript, but I can’t find a place image command that works.

Ideally I would give the AppleScript my image’s file path, and it would place said image in a file when executed.

Anybody do this before?


Solution

  • Do you have the Adobe Illustrator CC 2017 Reference PDF? This example is straight out of it:

    -- This function adds a new placed item to a document from a file reference,
    -- fileToPlace, which is passed in during the function call, fileToPlace is an
    -- alias or file reference to an art file, which must be set up before calling this
    -- function, itemPosition is a fixed point at which to position the placed item
    
    on PlacedItemCreate(fileToPlace)
      tell application "Adobe Illustrator"
        set itemPosition to {100.0, 200.0}
        set placedRef to make new placed item in document 1 ¬
        with properties {file path:fileToPlace, position:itemPosition}
      end tell
    end PlacedItemCreate