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

Choose the file page number to insert

Participant ,
Sep 09, 2014 Sep 09, 2014

Hi, I have this script:

#target illustrator

var FilePath = "~ / Desktop / TEST FILE VARIABLE ESKO.ai"

createRasterItem (FilePath)

// Creates a new raster item in a new document from a raster file

// JpgFilePath contains the full path and file name of the jpg file

createRasterItem function (FilePath) {

var = rasterfile File (FilePath);

myDoc app.documents.add = var ();

myPlacedItem myDoc.placedItems.add var = ();

myPlacedItem.file = rasterfile;

myPlacedItem.position = Array (0, myDoc.height);

}

But when I have a file containing more than one page, I would select the second page, does anyone know how to do this?

TOPICS
Scripting
585
Translate
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
Valorous Hero ,
Sep 09, 2014 Sep 09, 2014

This may help you:

        if(doc.artboards.length > 1){

            doc.artboards.setActiveArtboardIndex(1);

        }

It should select the 2nd artboard, and if your coordinate system is appropriately chosen to CoordinateSystem.ARTBOARDCOORDINATESYSTEM, I think it should give you what you are looking for.

Translate
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
Participant ,
Sep 09, 2014 Sep 09, 2014

Actually the file where I will insert contains only one page, but I will put this file to another file may contain more than one page and this can vary, I can choose which page will insert

EXAMPLE.jpg

Translate
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
Valorous Hero ,
Sep 09, 2014 Sep 09, 2014

Oooh, not sure if it's possible to do import options with javascript's placedItem.  Sorry, but if so, your best choice may be to open the multi-page doc and copy the contents of the artboards

Translate
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
Participant ,
Sep 10, 2014 Sep 10, 2014

Your idea is good, but I need the files are linked.

Is there any way to run the dialog file / insert through the script?

Translate
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
Valorous Hero ,
Sep 10, 2014 Sep 10, 2014

I just don't think that's possible with just javascript.  If it's really impossible, your next best option may be to have your script open your file with multiple artboards, automatically save them as each separate file in a special folder and place them into your main file every time.  If that actually saves you time, why not?

Translate
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
Participant ,
Sep 11, 2014 Sep 11, 2014
LATEST

It really saves a lot of time but the size will be bigger and I have more than 40,000 files if I have to migrate linked files to normal files will occupy much space on my server, anyway thank you very much for your attention.

Translate
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