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

A correct way to import ai file

Explorer ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

What is the correct way to import one ai file into another?

I'm using

#target illustrator

var pi = lay.placedItems.add();

pi.file = new File( Folder.desktop + '/test.ai' );

But this solution destroy groups of imported file and moreover if an object has fill and stroke then they will be detached into different objects.

The imported file is linked and the whole content placed into clipping mask ant it is not handy.

Is there a way to copy the content of imported file rather than import it to preserve groups and objects appearence?

TOPICS
Scripting

Views

524

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

correct answers 1 Correct answer

Advocate , May 01, 2018 May 01, 2018

Bonjour,

une approche parmi d'autres.

// JavaScript Document for Illustrator

// import_ai.js de elleere Tue, 1 May 2018 10:54:47 GMT

var docRef = activeDocument;

var fsName = "sample.ai";

var fileSpec = new File("~/"+fsName);

var placed = app.open(fileSpec);

  for (var i = 0; i < placed.pageItems.length; i++ ) {

    placed.pageItems.selected = true;

  }

  docSelected = selection;

  docRef.activat;

    if (docSelected) {

      layer = docRef.layers.add();

      layer.name = fsName;

        for ( i = 0; i < docSe

...

Votes

Translate

Translate
Adobe
Advocate ,
May 01, 2018 May 01, 2018

Copy link to clipboard

Copied

LATEST

Bonjour,

une approche parmi d'autres.

// JavaScript Document for Illustrator

// import_ai.js de elleere Tue, 1 May 2018 10:54:47 GMT

var docRef = activeDocument;

var fsName = "sample.ai";

var fileSpec = new File("~/"+fsName);

var placed = app.open(fileSpec);

  for (var i = 0; i < placed.pageItems.length; i++ ) {

    placed.pageItems.selected = true;

  }

  docSelected = selection;

  docRef.activat;

    if (docSelected) {

      layer = docRef.layers.add();

      layer.name = fsName;

        for ( i = 0; i < docSelected.length; i++ ) {

          docSelected.selected = false;

          newItem = docSelected.duplicate(layer);

        }

    }

  placed.close(SaveOptions.DONOTSAVECHANGES);

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