• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Scripting Illustrator using AppleScript - how to place a PDF file in a specific position and layer

New Here ,
Mar 14, 2020 Mar 14, 2020

Copy link to clipboard

Copied

Hello -

 

I am trying to automate my image creation pipeline and would like to program up the equivalent of paste (and scale) in illustrator. I am a newbie to scripting, but chose to use AppleScript, and I find the documentation far too sparse to be helpful.

 

My understanding is that I should be able to do this using either group item or placed item. However, if I try

 

set imageRef to make new placed item in imageLayer with properties {file path: imageFileName}

 

where imageLayer is defined using

 

set imageFileName to POSIX file "testFile.pdf"

 

while imageLayer is defined via

 

set imageLayer to layer 1 of docRef

 

However, when I try to execute the script, I get the following error message: "Adobe Illustrator got an error: Can’t make some data into the expected type."

 

Any advice would be very much appreciated! Also, if anyone could point me to the reference to the property fields of different objects, then that would also be very helpful (for example, where can I find the property fields for placed items or group items?

 

Thanks,

 

Carl

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Engaged ,
Mar 17, 2020 Mar 17, 2020

Copy link to clipboard

Copied

1. File paths must be absolute, e.g. "/Users/carl/testFile.pdf"

 

2. If you’re on AI 2020, the file path must be given as a string:

        set imageFileName to "/Users/carl/testFile.pdf"

   For earlier versions, it must be a file object:

        set imageFileName to POSIX file "/Users/carl/testFile.pdf"

 

3. To view an application’s AppleScript dictionary in Script Editor, choose File > Open Dictionary. PDF-based documentation  (same info, but also includes example scripts) is also available at: www.adobe.com/devnet/illustrator/scripting.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

LATEST

Hi Carl

 

Did you get this to work as I need to automate placing an image in illustrator as well.

 

AndyC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines