Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Your idea is good, but I need the files are linked.
Is there any way to run the dialog file / insert through the script?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now